Technology

Notation Symbols in Isolated Scope

In my previous blog we studied the scope in AngularJS(we read three types of scope in a directive, Parent Scope, Inherited Scope and Isolated Scope). Isolated Scope was completely Isolated after AngularJS-1.2 so we can not access Parent Scope directly. But sometimes we face a requirement where we want to access Parent Scope...

30-Jun-2014

Node.js

Scope in AngularJS

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...

30-Jun-2014

Node.js

Service in AngularJS

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...

29-Jun-2014

Technology

Common functionality among Multiple Controllers

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...

02-May-2014

Node.js

Angular Routes

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...

01-May-2014

Node.js

Component in AngularJS

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...

15-Apr-2014

Node.js

_id With Mongoose

Let us take a very common use-case: "There will be a registration page for users, where users will provide their required details along with their picture”. Details would be saved to MongoDB while the pictures would be uploaded to Cloudinary or S3 with user unique id." Suppose we have User Schema as given below: [js] /* * Schema...

12-Apr-2014

Node.js

Validation with Mongoose

In one of our Node.js projects, we used Mongoose module to interact with MongoDB. Mongoose provides us four types of built-in validation on schema as below: 1. Required: We can mark a field as required, which must be provided. 2. Limit: If field is type of Number in Schema, then we can restrict maximum and minimum value for that...

19-Feb-2014

Javascript/Ajax/JQuery, Node.js

Singleton Pattern with JavaScript

Many a times, we face a requirement where we need only one object of a class to communicate across the application. Singleton Pattern comes into role in this scenario. Singleton is one of my favorite Design Patterns. Singleton pattern restricts us to initialize more than one object. We implement Singleton by creating a class, having a...

14-Feb-2014

Javascript/Ajax/JQuery, Node.js

Equality(==) vs Identity(===)

In JavaScript, we have Equality (==) and Identity(===) operators for equality comparison between two values/operands. When first time we see Equality (==) and Identity (===) operators, then following questions arise in our mind. 1. What is difference between Equality (==) and Identity (===) ? 2. Is there a performance benefit with...

05-Feb-2014

Javascript/Ajax/JQuery, Node.js

Scope In JavaScript

Many a times we get confused with scope in JavaScript, So here I am going to put some light on scope. There are two types of scope in JavaScript. First one is, function scope which is also called as local scope, and second one is global scope. Function Scope: In JavaScript, variables are defined with function scope instead of block...

04-Feb-2014

Database

Group By in MongoDB(with $group)

MongoDB provides a rich set of aggregation. $group is one of them, with the help of $group, we can group documents (similar as group By in SQL). Lets understand by an example: Suppose we have following collection of blogs: [js] { userId:1, name:"Suroor", title:"AngularJS: Getting started with Directive", rating:3} { userId:2,...

04-Oct-2013