AngularJS, Front End Development
When a function of service or controller invoked via the injector then we have to annotate these functions so that the injector knows what service to inject into the function. In Angular, there are three ways of annotating code with service name - Inline Array Annotation $inject Property Annotation Implicit Annotation ...
AngularJS, Front End Development
In AngularJS, there are three ways to register a service in a module. Module's Factory Function Module's Config via $provide Module's Service Function Via Module's Factory Function We can register a service via Angular module’s "factory" function. This is commonly use to register a service. Registering service in...
AngularJS, Front End Development
AngularJS Deferred & Promises- Basic Understanding Table of Contents 1. Introduction to Asynchronous AngularJs 2. Callbacks- Basic Understanding 3. Callback Hell 4. Promise- A Better way of handling callbacks 5. Promise In AngularJS- $q Service 6. Deferred API 7. Promise API 8. Some other promise based...
AngularJS, Front End Development
Angular provides a very powerful means to transfer messages to scopes at different hierarchical level. We can dispatch an event upwards through the scope hierarchy by notifying all the registered "$rootScope.Scope" listeners in the hierarchy or downwards to all the child scopes. Angular provides these two functions to achieve the event...
AngularJS, Front End Development
$resouce is a perfect option to create a single page application which involve CRUD operations.You don't write your CRUD methods (create,read,update and delete) when you use it. A RESTful web service with one endpoint for a data type that does different things with that data type based on HTTP methods like GET, POST, PUT, DELETE,...
Recently I discovered that every directive in AngularJS has a priority score assigned to it. While the page is loaded the priority plays a very important role in setting the order of the execution of various directives in single DOM Element. The priority is used to sort the directives before their "compile" function gets called. In simple...
Angular provide services for handling non-view logic, communication with server(back-end) and can holds data & state. These services are singleton objects that can be used to share and organize code. For doing so, angular provides us five cool ways to make a service on the bases of once need. Following are the five approaches that...
There are lots of ways to validate a web page like HTML5 validations, but why not do it in a better interactive way by using AngularJS. AngularJS provides us with several form properties for validation, which helps in providing instant feedback in case validation is violated. $valid: return true when input field is valid. ...
AngularJS, Front End Development
Recently, I wanted to upgrade my Grails application to 2.4.3 and also switched from resource plugin to assets-pipeline plugin. As everything was going good in the development, so I pushed it to QA after which I was bombarded with JavaScript errors and missing providers. What has happened?? So here, Angular.js internal dependency...
Now a days , angular ui-router is being used actively for maintaining routes in angular applications. In my current project, I came across a use case in which I had to perform certain checks before executing certain route mapping. For example lets consider the most basic situation in which we want to directly show dashboard route in case...
When we work on AngularJS, scope become very important concept. So today we will understand the Scope in AngularJS. In almost every AngularJS Controller we use scope object which is auto injected by AngularJS in $scope named parameter. And that scope gets visible to marked HTML and its inner/child HTML, because of which HTML can access...
When we are working on MVC (or MVVM for AngularJS) Design-Patterns, our application is loosely coupled because of different independent components defined for e.g. Controller, View, Services, Modal/Data etc. All the components have their own work/role but today we will discuss only Services. Services are that part of application where...