pipeline of ngModelController

ngModelController is undoubtedly one of the reasons why AngularJS is so awesome . It is responsible for two way data binding , which is what people use when they are asked to display Angular powers. It is the eye candy of Angular . Yaa i sound like i am in love with it .. Well, yes i am. Using ngModelController in its usual form ( inside input fields with ng-model) is all easy and fun. All you have to do is give a model value to ng-model attribute and you are good to go.. <div ng-controller="databinding"> <input type="text" ng-model="user"...

Forms in angularJS (ngFormController)

Forms in angularJS are quite advanced then the normal HTML forms, and they work wonders with ngModelController. ngModelController, along with keeping the model and view in sync( by $formatters and $parsers) also helps in validating the data and checking if the value was changed from its default ( this is achieved by $pristine,$dirty,$valid,$invalid properties and by using the respective css classes) . There are a lot many properties and methods of ngModelController but we will mention these four for simplicity . ngModelController.$pristine returns...

Scopes in directives of AngularJS

For this blog , you need a basic understanding about custom directives in AngularJS . Scope is a concept of AngularJS which can be pretty tricky at times, and can get difficult to make sense out of it . Thanks, to some extensions, like batarang , we can check the scope IDs of elements and check which have same or different scope.   All DOM elements that have been compiled by AngularJS have a scope associated  with them. In most cases DOM elements do not have scopes defined directly on them but get their scope from some ancestor element....

Various formats of referencing directives in angularJS

We can use a variety of naming conventions to refernce directives in HTML markup . In Angular JS all the directives are accessed in modules as camel case like 'ngResource' or 'ngModel' . But in an HTML template, there are various methods to access the directive . Like for ngModel ,  we need to use either snakecase form (ng-model), colon-separated (ng:model) or the underscore-separated (ng_model) form. Additionally, each reference to a directive can be prefixed with either x or data. So, to say , the combinations we can use are :: ng-model,...

Promise API($q) explained in angularJS

Promise API may sound like an unncessary complexity but it helps a great deal in making the chaining of function calls and handling exceptions bearable . While, these things seem pretty easy in the synchronous world, it becomes very perplexing in the asynchronous javascript world. AngularJS comes with the $q (Pomise API) , which is lightweight . Many Angular services like $http, $timeout and others heavily rely on promise style APIs (they return a promise, by default) , so it is a good idea to get familiar with $q in order to use those services...