Skip to main content

Posts

Showing posts from July, 2015

Why choose AngularJs for your next Project?

Hello everyone, Today's I received an email regarding the Questions " Why choose AngularJs  in my next Project?". There are difference reasons to developing the web application using AngularJs as given below.   Support MVC  and MV* Architecture.   We can create custom directives. A declarative user interface. Data models work with POJO  (Plain Old JavaScript Object).   Ease of Use  and  Supports Single Page Applications (SPA) . Angular is Client Side Solution. Flexibility of Filters .  AngularJs Enables a Design and Development Workflow. Enable you to create software more quickly and with less effort Easily manipulate to DOM elements. Result in software that is more maintainable. Testing using Dependency Injection. Thank You!  Please add any else you want in the comment box. I will update it with your suggestion...

get month start date and end date in JavaScript

Hello everyone, I am going to share the code sample to get start date and end date of current month using JavaScript . All the detail as given below. The live demo link http://embed.plnkr.co/tO4vTm/preview The JavaScript code < script >     var nowdate = new Date() ;     var monthStartDay = new Date(nowdate.getFullYear(), nowdate.getMonth(), 1);     var monthEndDay = new Date(nowdate.getFullYear(), nowdate.getMonth() + 1, 0);     $( function () {         $( "#startDate" ).html(monthStartDay);         $( "#endDate" ).html(monthEndDay);     }); </ script > The output look like this. The Live demo code sample to get the month start date and end date in JavaScript as given below. < !DOCTYPE html > < html > < head >     < meta charset ="utf-8" />     < script src ="http://code.jquery.com/jquery-2.1.4.min.js"></ script >     < scrip

Get Remaining Days in Current Month using JavaScript

JavaScript code as given below. var getRemanningDays  = function () {         var date = new Date();         var time = new Date(date.getTime());         time.setMonth(date.getMonth() + 1);         time.setDate(0);         alert(time.getDate() > date.getDate() ? time.getDate() - date.getDate() : 0); } Demo output link : http://embed.plnkr.co/FFUXhl/preview Live example code as given below. < !DOCTYPE html > < html > < head >     < meta charset ="utf-8" />     < title > Remaining days in current month in javascript </ title >     < script src ="http://code.jquery.com/jquery-2.1.4.min.js"></ script >     < script >         // Add your javascript here         $( function () {             getRemanningDays();         });         var getRemanningDays = function () {             var date = new Date();             var time = new Date(date

Controller vs. Link Directive

controller vs. link directive The output demo link : http://embed.plnkr.co/EPEhfb/preview AngularJs code : var myApp = angular.module( 'CtrlLinkApp' , []);         myApp.controller( 'CtrlLinkCtrl' , function ($scope) {             $scope.name = 'Anil, ' ;         });         myApp.directive( 'controllerVsLink' , function () {             return {                 restrict: 'E' ,                 template: '<p>Hello controller vs. link :  {{name}}!</p>' ,                 controller: function ($scope, $element) {                     $scope.name = $scope.name + "Sunil, " ;                 },                 link: function (scope, el, attr) {                     scope.name = scope.name + "Sushil " ;                 }             }         }); HTML code sample : < div ng-app ="CtrlLinkApp" ng-controller ="CtrlLinkCtrl">   

How to change body style in AngularJs?

Hello everyone, I am going to share the code sample for how to change body style in angularjs and all detail code as given below. The live demo link http://embed.plnkr.co/0AVI9E/preview AngularJs code sample: var app = angular.module( 'styleApp' , []); app.controller( 'styleAppCtrl' , function ($scope, $http, $document ) {     angular.element ($document).find( 'body' ).removeClass( 'my-style-calss' ); }); HTML  code sample: < div ng-app ="styleApp" class ="my-style-calss">     < div ng-controller ="styleCtrl">         change body style in angularjs     </ div > </ div > Full Live demo code(HTML + AngularJs): < !DOCTYPE html > < html > < head >     < meta charset ="utf-8" />     < title > change body style in angularjs </ title >     < script src ="https://ajax.googleapis.com/ajax/libs/