SlideShare a Scribd company logo
Angular
In
Depth
Presenter: Nakul Suneja, Mindfire Solutions
Date: 26/03/2015
Earlier we discussed:
1. Single Page Application.
2.What is Angular.js?
3.Why Angular.j
4.Modules.
5.Controllers
6.Views
7.Directives
8.Angular Routes
9.Custom Directives
10. Angular Services & Custom Services Demo
11. Filters & Custom Filters Demo.
Presenter: Nakul, Mindfire Solutions
Angular in Depth.
1. Angular Custom Directives.
2. Isolated Scopes in Directives.
3. DI with Custom Directives.
4. What is Services, Factories Providers & Value in
Depth.
5. Custom Services & Factories in Depth.
6. Useful Tools with Angularjs.
Presenter: Nakul, Mindfire Solutions
Directives are markers on Dom Elements(such as attributes, tags, and class
names) that tell HTML compiler ($compile) to attach a given behavior to a
DOM element (or transform it, replace it, etc.),When Angular bootstraps
your application, the HTML compiler traverses the DOM matching
directives
against the DOM elements.
Some angular built-in directives
l The ng-app - Bootstrapping your app and defining its scope. (<html ng-
app>).
l The ng-controller - defines which controller will be in charge of your
view.
l (<input ng-controller=”xyz”>).
l The ng-repeat - Allows for looping through collections.
l The ng-init – Allows to Initialize any Data Model Object.
What is a Directive?
Presenter: Nakul, Mindfire Solutions
AngularJS Help for Directives
Custom Directives
Presenter: Nakul, Mindfire Solutions
You can implement the following types of directives:
1. Element directives
2. Attribute directives
3. CSS class directives
4. Comment directives
To create Each type of directive You can use restrict to EAC
Presenter: Nakul, Mindfire Solutions
Custom Directives
app.directive('myTag', function() {
return {
restrict: 'A', /// A => Attributes, E=> Elements, C=> Classes
template:'<h3>My Tag HTML</h3>',
}
});
Presenter: Nakul, Mindfire Solutions
Isolation in Directives
Isolate scope can be a tough concept to understand when you are first starting out with AngularJS.
Since directives are reusable, sharing $scope can create undesirable behavior with shared state.
By isolating scopes you are able to control how and when your directives will share state with controllers and other
directives.
Isolation with Directive:
app.directive('myFirstName', function() {
return {
restrict: 'E', /// Three Type of Directives We can Define A => Attributes, Elements, Classes
scope: {
},
template:'First Name: <input type="text" ng-model="first_name">{{first_name}}',
}
});
Presenter: Nakul, Mindfire Solutions
Transclude Directives
Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.Any
existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.
app.controller('UserController', function($scope) {
$scope.title = 'Lorem Ipsum';
$scope.text = 'Neque porro quisquam est qui dolorem';
})
app.directive('pane', function(){
return {
restrict: 'E',
transclude: true,
scope: { title:'@' },
template: '<div style="border: 1px solid black;">' +
'<div style="background-color: gray">{{title}}</div>' +
'<ng-transclude></ng-transclude>' +
'</div>'
};
});
Providers
Presenter: Nakul, Mindfire Solutions
Angular Services.
Angular services are substitutable objects that are wired together using dependency injection (DI). You
can use
services to organize and share code across your app.
Angular services are:
 Lazily instantiated – Angular only instantiates a service when an application component depends on
it.
 Singletons – Each component dependent on a service gets a reference to the single instance
 generated by the service factory.
AngularJS internal services: AngularJS internally provides many services that we can use in our
application. $http is one example (Note: All angularjs internal services starts with $ sign). There are
other useful services such as $route, $window, $location etc.
module.controller('UserController', function($http){
//...
});
module.controller('AdminController', function($window){
//...
});
Presenter: Nakul, Mindfire Solutions
Presenter: Nakul, Mindfire Solutions
Angular Custom Services.
We can define our own custom services in angular js app and use
them wherever required.
var module = angular.module('myapp', []);
module.service('userService', function(){
this.users = ['User1', 'User2', 'User3'];
});
When declaring serviceName as an injectable argument you will be
provided with an instance of the function. In other words new
FunctionYouPassedToService(). This object instance becomes the
service object that AngularJS registers and injects later to other
services / controllers if required.
Filters & Custom Filters
A filter formats the value of an expression for display to the user. They can be used in view
templates,
controllers or services and it is easy to define your own filter.
{{ expression | filter1 | filter2 | ... }}
We have in-built Filters Available as
 Number : {{ 1234 | number:2 }}
 Currency : {{ 12 | currency }}
 Date: {{ date_expression | date : format : timezone}}
 Lowercase : {{ lowercase_expression | lowercase}}
 Uppercase : {{ lowercase_expression | uppercase}}
 Filter : <tr ng-repeat="friend in friends | filter:'a'">
 OrderBy : <tr ng-repeat="friend in friends | orderBy:'-age'">
Custom Filter :
app.filter('reverse', function() { // Custom Filter Reverse
return function(input) {
var out = input.split('').reverse().join();
return out;
};
});
Presenter: Nakul, Mindfire Solutions
Tools with Angular
Presenter: Nakul, Mindfire Solutions
Karma, Jasmine, Grunt, Bower, Yeoman… What are all these tools?
Karma is Google’s JavaScript test runner and the natural choice for testing
AngularJS. In addition to allowing you to run your tests on real browsers
(including phone/tablet browsers), it is also test framework agnostic; which
means that you can use it in conjunction with any test framework of your
choice (such as Jasmine, Mocha, or QUnit, among others).
Jasmine will be our test framework of choice, at least for this post. Its syntax
is quite similar to that of RSpec, if you’ve ever worked with that. (If you
haven’t, don’t worry; we’ll check it out in greater detail later in this tutorial.)
Grunt is a task runner that helps automate several repetitive tasks, such as
minification, compilation (or build), testing, and setting up a preview of your
AngularJS application.
Bower is a package manager that helps you find and install all your
application dependencies, such as CSS frameworks, JavaScript libraries,
and so on. It runs over git, much like Rails bundler, and avoids the need to
manually download and update dependencies.
Yeoman is a toolset containing 3 core components: Grunt, Bower, and the
scaffolding tool Yo. Yo generates boilerplate code with the help of generators
(which are just scaffolding templates) and automatically configures Grunt
and Bower for your project. You can find generators for almost any
JavaScript framework (Angular, Backbone, Ember, etc.), but since we’re
focusing here on Angular, we’re going to use the generator-angular project.
References
1.Angular Org : https://docs.angularjs.org/api
2.W3School:http://www.w3schools.com/angul
ar/default.asp
3.Tuts+ :
http://code.tutsplus.com/courses/hands-on-
angular?
utm_source=Tuts+&utm_medium=website
&utm_campaign=relatedcourses&utm_cont
ent=sidebar&WT.mc_id=Tuts+_website_rel
atedcourses_sidebar
Presenter: Nakul, Mindfire Solutions
QUESTIONS?
Presenter: Nakul, Mindfire Solutions
Thank you

More Related Content

PDF
"Angular.js Concepts in Depth" by Aleksandar Simović
PDF
AngularJS - dependency injection
PPTX
AngularJs $provide API internals & circular dependency problem.
PDF
Workshop 13: AngularJS Parte II
PPTX
AngularJs-training
PPTX
AngularJs
PDF
Workshop 17: EmberJS parte II
PPTX
AngularJS Internal
"Angular.js Concepts in Depth" by Aleksandar Simović
AngularJS - dependency injection
AngularJs $provide API internals & circular dependency problem.
Workshop 13: AngularJS Parte II
AngularJs-training
AngularJs
Workshop 17: EmberJS parte II
AngularJS Internal

What's hot (20)

PPTX
Angular js
PDF
Dependency Injection @ AngularJS
PDF
Explaination of angular
PDF
Workshop 19: ReactJS Introduction
PDF
Workshop 14: AngularJS Parte III
PDF
Solid angular
PDF
Custom AngularJS Directives
PDF
Hooks and Events in Drupal 8
PPTX
AngularJS.part1
PDF
Angular custom directives
PPTX
Angular2 + rxjs
ODP
Angular js-crash-course
PDF
Workshop 23: ReactJS, React & Redux testing
PDF
The state of hooking into Drupal - DrupalCon Dublin
PDF
Opinionated AngularJS
PDF
Workshop 20: ReactJS Part II Flux Pattern & Redux
PDF
Workshop 26: React Native - The Native Side
PDF
Events: The Object Oriented Hook System.
PDF
Workshop 2: JavaScript Design Patterns
PDF
Workshop 22: React-Redux Middleware
Angular js
Dependency Injection @ AngularJS
Explaination of angular
Workshop 19: ReactJS Introduction
Workshop 14: AngularJS Parte III
Solid angular
Custom AngularJS Directives
Hooks and Events in Drupal 8
AngularJS.part1
Angular custom directives
Angular2 + rxjs
Angular js-crash-course
Workshop 23: ReactJS, React & Redux testing
The state of hooking into Drupal - DrupalCon Dublin
Opinionated AngularJS
Workshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 26: React Native - The Native Side
Events: The Object Oriented Hook System.
Workshop 2: JavaScript Design Patterns
Workshop 22: React-Redux Middleware
Ad

Viewers also liked (13)

PPT
Ext js Part 2- MVC
PPT
Get started with watch kit development
PPT
Django Models
PPT
Adaptive Layout In iOS 8
ODP
Oracle Sql Developer-Getting Started
PPT
High Availability of Azure Applications
ODP
Material Design in Android
PDF
Génération de rapport avec Jasper Report
PDF
A Short Intorduction to JasperReports
PPT
Advanced Jasper Reports
PDF
Introduction to Jasper Reports
ODP
Japer Reports
Ext js Part 2- MVC
Get started with watch kit development
Django Models
Adaptive Layout In iOS 8
Oracle Sql Developer-Getting Started
High Availability of Azure Applications
Material Design in Android
Génération de rapport avec Jasper Report
A Short Intorduction to JasperReports
Advanced Jasper Reports
Introduction to Jasper Reports
Japer Reports
Ad

Similar to Angular In Depth (20)

PPTX
Intoduction to Angularjs
PDF
AngularJS in practice
PPTX
Angular workshop - Full Development Guide
PDF
AngularJS Basics
PPTX
Understanding angular js
ODP
AngularJs Crash Course
PPTX
Introduction to single page application with angular js
PPTX
Mean stack Magics
PPTX
Front end development with Angular JS
PDF
Moving from selenium to protractor for test automation
PPTX
Dive into Angular, part 1: Introduction
ODP
Introduction to Angular 2
DOCX
Angular.js interview questions
PDF
AngularJS Custom Directives
PPTX
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
PDF
One Weekend With AngularJS
PPT
introduction to Angularjs basics
PDF
Top 7 Angular Best Practices to Organize Your Angular App
PDF
Angular js
PPTX
Training On Angular Js
Intoduction to Angularjs
AngularJS in practice
Angular workshop - Full Development Guide
AngularJS Basics
Understanding angular js
AngularJs Crash Course
Introduction to single page application with angular js
Mean stack Magics
Front end development with Angular JS
Moving from selenium to protractor for test automation
Dive into Angular, part 1: Introduction
Introduction to Angular 2
Angular.js interview questions
AngularJS Custom Directives
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
One Weekend With AngularJS
introduction to Angularjs basics
Top 7 Angular Best Practices to Organize Your Angular App
Angular js
Training On Angular Js

More from Mindfire Solutions (20)

PDF
Physician Search and Review
PDF
diet management app
PDF
Business Technology Solution
PDF
Remote Health Monitoring
PDF
Influencer Marketing Solution
PPTX
IOT Hands On
PPTX
Glimpse of Loops Vs Set
PPT
Introduction to Auto-layout : iOS/Mac
PPT
LINQPad - utility Tool
PPTX
Swift vs Objective-C
ODP
Introduction to OData
PPT
ExtJs Basic Part-1
PPT
Spring Security Introduction
PPT
Django-Queryset
PPTX
Bower Fundamentals
PPT
Digesting jQuery
PPT
Django CMS & Integrating it with django shop
PPTX
Introduction to Maven
PPT
Angular Seminar-js
PPT
My SQL Replication and Scaling
Physician Search and Review
diet management app
Business Technology Solution
Remote Health Monitoring
Influencer Marketing Solution
IOT Hands On
Glimpse of Loops Vs Set
Introduction to Auto-layout : iOS/Mac
LINQPad - utility Tool
Swift vs Objective-C
Introduction to OData
ExtJs Basic Part-1
Spring Security Introduction
Django-Queryset
Bower Fundamentals
Digesting jQuery
Django CMS & Integrating it with django shop
Introduction to Maven
Angular Seminar-js
My SQL Replication and Scaling

Recently uploaded (20)

PDF
Cost to Outsource Software Development in 2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Nekopoi APK 2025 free lastest update
PDF
top salesforce developer skills in 2025.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
history of c programming in notes for students .pptx
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administraation Chapter 3
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Cost to Outsource Software Development in 2025
Odoo Companies in India – Driving Business Transformation.pdf
Computer Software and OS of computer science of grade 11.pptx
Nekopoi APK 2025 free lastest update
top salesforce developer skills in 2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
history of c programming in notes for students .pptx
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Why Generative AI is the Future of Content, Code & Creativity?
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Digital Strategies for Manufacturing Companies
System and Network Administraation Chapter 3
Odoo POS Development Services by CandidRoot Solutions
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms I-SECS-1021-03
Upgrade and Innovation Strategies for SAP ERP Customers
Design an Analysis of Algorithms II-SECS-1021-03
medical staffing services at VALiNTRY
iTop VPN Free 5.6.0.5262 Crack latest version 2025

Angular In Depth

  • 1. Angular In Depth Presenter: Nakul Suneja, Mindfire Solutions Date: 26/03/2015
  • 2. Earlier we discussed: 1. Single Page Application. 2.What is Angular.js? 3.Why Angular.j 4.Modules. 5.Controllers 6.Views 7.Directives 8.Angular Routes 9.Custom Directives 10. Angular Services & Custom Services Demo 11. Filters & Custom Filters Demo.
  • 3. Presenter: Nakul, Mindfire Solutions Angular in Depth. 1. Angular Custom Directives. 2. Isolated Scopes in Directives. 3. DI with Custom Directives. 4. What is Services, Factories Providers & Value in Depth. 5. Custom Services & Factories in Depth. 6. Useful Tools with Angularjs.
  • 4. Presenter: Nakul, Mindfire Solutions Directives are markers on Dom Elements(such as attributes, tags, and class names) that tell HTML compiler ($compile) to attach a given behavior to a DOM element (or transform it, replace it, etc.),When Angular bootstraps your application, the HTML compiler traverses the DOM matching directives against the DOM elements. Some angular built-in directives l The ng-app - Bootstrapping your app and defining its scope. (<html ng- app>). l The ng-controller - defines which controller will be in charge of your view. l (<input ng-controller=”xyz”>). l The ng-repeat - Allows for looping through collections. l The ng-init – Allows to Initialize any Data Model Object. What is a Directive?
  • 5. Presenter: Nakul, Mindfire Solutions AngularJS Help for Directives
  • 7. You can implement the following types of directives: 1. Element directives 2. Attribute directives 3. CSS class directives 4. Comment directives To create Each type of directive You can use restrict to EAC Presenter: Nakul, Mindfire Solutions Custom Directives app.directive('myTag', function() { return { restrict: 'A', /// A => Attributes, E=> Elements, C=> Classes template:'<h3>My Tag HTML</h3>', } });
  • 8. Presenter: Nakul, Mindfire Solutions Isolation in Directives Isolate scope can be a tough concept to understand when you are first starting out with AngularJS. Since directives are reusable, sharing $scope can create undesirable behavior with shared state. By isolating scopes you are able to control how and when your directives will share state with controllers and other directives. Isolation with Directive: app.directive('myFirstName', function() { return { restrict: 'E', /// Three Type of Directives We can Define A => Attributes, Elements, Classes scope: { }, template:'First Name: <input type="text" ng-model="first_name">{{first_name}}', } });
  • 9. Presenter: Nakul, Mindfire Solutions Transclude Directives Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted. app.controller('UserController', function($scope) { $scope.title = 'Lorem Ipsum'; $scope.text = 'Neque porro quisquam est qui dolorem'; }) app.directive('pane', function(){ return { restrict: 'E', transclude: true, scope: { title:'@' }, template: '<div style="border: 1px solid black;">' + '<div style="background-color: gray">{{title}}</div>' + '<ng-transclude></ng-transclude>' + '</div>' }; });
  • 11. Angular Services. Angular services are substitutable objects that are wired together using dependency injection (DI). You can use services to organize and share code across your app. Angular services are:  Lazily instantiated – Angular only instantiates a service when an application component depends on it.  Singletons – Each component dependent on a service gets a reference to the single instance  generated by the service factory. AngularJS internal services: AngularJS internally provides many services that we can use in our application. $http is one example (Note: All angularjs internal services starts with $ sign). There are other useful services such as $route, $window, $location etc. module.controller('UserController', function($http){ //... }); module.controller('AdminController', function($window){ //... }); Presenter: Nakul, Mindfire Solutions
  • 12. Presenter: Nakul, Mindfire Solutions Angular Custom Services. We can define our own custom services in angular js app and use them wherever required. var module = angular.module('myapp', []); module.service('userService', function(){ this.users = ['User1', 'User2', 'User3']; }); When declaring serviceName as an injectable argument you will be provided with an instance of the function. In other words new FunctionYouPassedToService(). This object instance becomes the service object that AngularJS registers and injects later to other services / controllers if required.
  • 13. Filters & Custom Filters A filter formats the value of an expression for display to the user. They can be used in view templates, controllers or services and it is easy to define your own filter. {{ expression | filter1 | filter2 | ... }} We have in-built Filters Available as  Number : {{ 1234 | number:2 }}  Currency : {{ 12 | currency }}  Date: {{ date_expression | date : format : timezone}}  Lowercase : {{ lowercase_expression | lowercase}}  Uppercase : {{ lowercase_expression | uppercase}}  Filter : <tr ng-repeat="friend in friends | filter:'a'">  OrderBy : <tr ng-repeat="friend in friends | orderBy:'-age'"> Custom Filter : app.filter('reverse', function() { // Custom Filter Reverse return function(input) { var out = input.split('').reverse().join(); return out; }; }); Presenter: Nakul, Mindfire Solutions
  • 14. Tools with Angular Presenter: Nakul, Mindfire Solutions Karma, Jasmine, Grunt, Bower, Yeoman… What are all these tools? Karma is Google’s JavaScript test runner and the natural choice for testing AngularJS. In addition to allowing you to run your tests on real browsers (including phone/tablet browsers), it is also test framework agnostic; which means that you can use it in conjunction with any test framework of your choice (such as Jasmine, Mocha, or QUnit, among others). Jasmine will be our test framework of choice, at least for this post. Its syntax is quite similar to that of RSpec, if you’ve ever worked with that. (If you haven’t, don’t worry; we’ll check it out in greater detail later in this tutorial.) Grunt is a task runner that helps automate several repetitive tasks, such as minification, compilation (or build), testing, and setting up a preview of your AngularJS application. Bower is a package manager that helps you find and install all your application dependencies, such as CSS frameworks, JavaScript libraries, and so on. It runs over git, much like Rails bundler, and avoids the need to manually download and update dependencies. Yeoman is a toolset containing 3 core components: Grunt, Bower, and the scaffolding tool Yo. Yo generates boilerplate code with the help of generators (which are just scaffolding templates) and automatically configures Grunt and Bower for your project. You can find generators for almost any JavaScript framework (Angular, Backbone, Ember, etc.), but since we’re focusing here on Angular, we’re going to use the generator-angular project.
  • 15. References 1.Angular Org : https://docs.angularjs.org/api 2.W3School:http://www.w3schools.com/angul ar/default.asp 3.Tuts+ : http://code.tutsplus.com/courses/hands-on- angular? utm_source=Tuts+&utm_medium=website &utm_campaign=relatedcourses&utm_cont ent=sidebar&WT.mc_id=Tuts+_website_rel atedcourses_sidebar
  • 16. Presenter: Nakul, Mindfire Solutions QUESTIONS?
  • 17. Presenter: Nakul, Mindfire Solutions Thank you