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...
Many a times, we see a requirement, where we have to write same functions in multiple controllers just to share a common functionality among them, which is a bad approach, because in future, if any changes are required to that function, we’ll have to make the changes manually in all the copies of that function where it is defined or if...
As we all of know that AngularJS is very popular and powerful front-end framework, which helps us to build rich UI/UX applications. AngularJS has many cool things/features, but today we will concentrate on routes only and will try to make a small single page application like Facebook/Gmail with the help of routes, where we will perform...
In my Angular project, I came across a situation where i had to render some html markup, but the tricky thing was, the markup was contained in some angular scope variable. And when outputting it, it just printed out the html markup as basic text. A quick Google search informed me about the directive ng-bind-html and...
When we are working on front-end part, then many times we face a situation where same HTML repeats on the same page or different pages, at that time we think of making that HTML a component. When using AngularJS framework, we can easily make components with the help of directives. Let's quickly understand what a directive is? A directive...
In my current grails application, we have started using the AngularJS after realizing that the GSP template engine is a bit slow. Now, I realize how efficient AngularJS can be, and think of sharing my first impressions while using AngularJS with grails app. Following are some of the reasons, that I find, makes AngularJS stands out: ...
AngularJS, Front End Development
While using AngularJS, you will usually come across this situation when you want to copy one object to another object. In such case you will have only two solutions: angular.copy() or angular.extend(). Lets see how these solutions work. 1. angular.copy(source, destination) : It creates a deep copy of source object or array and...
AngularJS, Front End Development
While using AngularJS, we come across situation in which we want to display some data in certain format or some specific condition to be applied on the data. In this case, filters comes to rescue. We can define our custom filters and return filtered data in whichever way we want to display it. Lets learn it through an example: ...
AngularJS, Front End Development
In this post we will go through an important aspect of AngularJS i.e., Directives. Directives helps us do things in a better and cleaner way. Lets get into the code rather going into theoretical explanations, which will make it more clear what actually directives do. We have written a simple directive below which shows some HTML when...
AngularJS, Front End Development
The topic of this post is quite confusing for many developers as they face problems in identifying the best practice to share data between controllers in AngularJS. Some of the articles out there tell to use $rootScope but that's not the correct approach to enable this functionality. A more cleaner and better way of doing so is through...
AngularJS, Front End Development
We have already seen the concept of routes and multiple views in my previous blog. Now let's see how to implement it in code. To implement the concept of routing in AngularJS, we need to create modules. Inside a module config, we can define routes. [javascript] File : js/modules.js angular.module('videoModule', []). ...