SlideShare a Scribd company logo
1 of 16
Download to read offline
AngularJS
Basic Building Blocks
Prepared by
Manaday Mavani
April, 2016
It is
● Frontend JavaScript MVC framework
● 100% JavaScript
● 100% client-side
It is not
● JS Library
● DOM Manipulation Library like jQuery
● Just another templating system
It helps in
● Single Page Applications
● Logical separation (MVC)
● Two way data binding
● Reusable components
● Templating
● Filters
● Form validations
Basic Building Blocks
● Directives - Abstract instruction on HTML
● Modules - Collection
● Expressions - Templating mechanism to bind dynamic content
● Controllers - Business logic stuff
● $scope - Glue between View and Controller
● Services - Encapsulate related responsibilities
● Filters - Transform data
● Dependency Injection - Delegate responsibility to the injector
Primary Directives
● ng-app
● ng-controller
● ng-model
● ng-repeat
● ng-include
● ng-change
● ng-class
● ng-show
● ng-hide
● ng-if
● ng-view
● ng-switch
● ng-click
ng-app
● Provides auto-bootstrap
● Specify AngularJS module to be used as root module for the application
● Typically placed near root element
○ <html ng-app=”app-name”> OR <body ng-app=”app-name”>
● Can not be nested within another ng-app
● Example - http://plnkr.co/edit/0YNo7LZtkVJnY2iDl4QO?p=preview
ng-controller
● Attaches a controller class to the view
● Declaration styles
○ as syntax: ng-controller=”SettingsController as settings”
○ $scope way: ng-controller=”SettingsController”
● Example: http://plnkr.co/edit/SPtMXwVPifnK2qGD0Bsf?p=preview
ng-model
● Used for 2-way bindings for form elements like input, select, textarea
● <input type=”text” ng-model=”scope-prop” />
● Example: http://plnkr.co/edit/Pf04Gkw8xaSZIPBQbNPg?p=preview
ng-click
● Allows to specify custom behavior when clicked
● <button ng-click=”count = count + 1”>Increment</button>
● Example: http://plnkr.co/edit/l7LavHKpeXA2RQc47UDb?p=preview
ng-include
● Fetches, compiles and includes an external HTML fragment
● Helps to abstract away the details
● <ng-include src="'PartialTemplate.html'" onload="expression"></ng-include>
● Example: http://plnkr.co/edit/A9Sj6pIDk4TDJytzwXth?p=preview
ng-class
● To dynamically set CSS classes on HTML element by data binding expression
● ng-class operates in 3 different ways
○ If expression is string, it should be one or more space-delimited class names
○ If expression is object, it should like key-value pair where key represents class name
○ If expression is array, each element should either be a string or an object
● Examples:
○ Basic: http://plnkr.co/edit/A9Sj6pIDk4TDJytzwXth?p=preview
○ Advanced: http://plnkr.co/edit/67YGWFFN7h7SBTPXUREC?p=info
Let’s Build: Github Viewer App
● Pages: Search, Repositories, Contributors
● You will learn
○ Basic app structure
○ Controllers implementation
○ Services to fetch data from API Endpoints
○ Routing
○ Sorting
● Source code on Github - https://github.com/ManadayM/ngGithubViewer
Resources
● Shaping up with AngularJS by Codeschool
● AngularJS Fundamentals By Egghead.io
● A Better Way to Learn AngularJS by Thinkster
● AngularJS Blog Series by LosTechies
● AngularJS Masterclass on Udemy (Paid)
● Controller As Syntax
● $scope vs this
● Custom Directives
● AngularJS Styleguide by Johnpapa
● Promises by HTML5Rocks, Promises explained by Toptal
Thanks!

More Related Content

What's hot

Web topic 21 pass info via javascript
Web topic 21  pass info via javascriptWeb topic 21  pass info via javascript
Web topic 21 pass info via javascriptCK Yang
 
Live Project On ASP.Net Core 2.0 MVC - Free Webinar
Live Project On ASP.Net Core 2.0 MVC - Free WebinarLive Project On ASP.Net Core 2.0 MVC - Free Webinar
Live Project On ASP.Net Core 2.0 MVC - Free WebinarMohd Manzoor Ahmed
 
Grails gotchas and best practices
Grails gotchas and best practicesGrails gotchas and best practices
Grails gotchas and best practicesTom Henricksen
 
Performance & dev tools
Performance & dev toolsPerformance & dev tools
Performance & dev toolsGuy Yogev
 
JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationSoumen Santra
 
The angular way 19 october 2013 Gdańsk
The angular way   19 october 2013 GdańskThe angular way   19 october 2013 Gdańsk
The angular way 19 october 2013 GdańskMarcin Wosinek
 
Concept of flexible open api server with node.js
Concept of  flexible open api server with node.jsConcept of  flexible open api server with node.js
Concept of flexible open api server with node.js주용 오
 

What's hot (10)

Web topic 21 pass info via javascript
Web topic 21  pass info via javascriptWeb topic 21  pass info via javascript
Web topic 21 pass info via javascript
 
Javascript DOM
Javascript DOMJavascript DOM
Javascript DOM
 
Live Project On ASP.Net Core 2.0 MVC - Free Webinar
Live Project On ASP.Net Core 2.0 MVC - Free WebinarLive Project On ASP.Net Core 2.0 MVC - Free Webinar
Live Project On ASP.Net Core 2.0 MVC - Free Webinar
 
Grails gotchas and best practices
Grails gotchas and best practicesGrails gotchas and best practices
Grails gotchas and best practices
 
Performance & dev tools
Performance & dev toolsPerformance & dev tools
Performance & dev tools
 
JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & Implementation
 
Chrome DevTools Basics
Chrome DevTools BasicsChrome DevTools Basics
Chrome DevTools Basics
 
What is HTML
What is HTMLWhat is HTML
What is HTML
 
The angular way 19 october 2013 Gdańsk
The angular way   19 october 2013 GdańskThe angular way   19 october 2013 Gdańsk
The angular way 19 october 2013 Gdańsk
 
Concept of flexible open api server with node.js
Concept of  flexible open api server with node.jsConcept of  flexible open api server with node.js
Concept of flexible open api server with node.js
 

Viewers also liked (11)

Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
After Effects for blog
After Effects for blogAfter Effects for blog
After Effects for blog
 
Sound
SoundSound
Sound
 
Aco blog
Aco blogAco blog
Aco blog
 
Bilancio Expo Milano 2015
Bilancio Expo Milano 2015Bilancio Expo Milano 2015
Bilancio Expo Milano 2015
 
فهد الفضل cv-FR
فهد الفضل cv-FRفهد الفضل cv-FR
فهد الفضل cv-FR
 
Heppy
HeppyHeppy
Heppy
 
GulpGruntNPM
GulpGruntNPMGulpGruntNPM
GulpGruntNPM
 
NPM, Bower and Gulp Kickstart in Visual Studio
 NPM, Bower and Gulp Kickstart in Visual Studio NPM, Bower and Gulp Kickstart in Visual Studio
NPM, Bower and Gulp Kickstart in Visual Studio
 
Meetup#6: AWS-AI & Lambda Serverless
Meetup#6: AWS-AI & Lambda Serverless Meetup#6: AWS-AI & Lambda Serverless
Meetup#6: AWS-AI & Lambda Serverless
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 

Similar to AngularJS Basics

Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in ComponentsAnton Ivanov
 
Introduction to AngularJS By Bharat Makwana
Introduction to AngularJS By Bharat MakwanaIntroduction to AngularJS By Bharat Makwana
Introduction to AngularJS By Bharat MakwanaBharat Makwana
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014Sarah Hudson
 
GDayX - Advanced Angular.JS
GDayX - Advanced Angular.JSGDayX - Advanced Angular.JS
GDayX - Advanced Angular.JSNicolas Embleton
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and conceptsSuresh Patidar
 
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseEPAM Systems
 
Foster - Getting started with Angular
Foster - Getting started with AngularFoster - Getting started with Angular
Foster - Getting started with AngularMukundSonaiya1
 
Angular.js presentation
Angular.js presentationAngular.js presentation
Angular.js presentationMoran Fine
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksMario Heiderich
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSShyjal Raazi
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkAlive Kuo
 
Angular.js for beginners
Angular.js for beginners Angular.js for beginners
Angular.js for beginners Basia Madej
 

Similar to AngularJS Basics (20)

AngularJS Workshop
AngularJS WorkshopAngularJS Workshop
AngularJS Workshop
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
Tango with django
Tango with djangoTango with django
Tango with django
 
Introduction to AngularJS By Bharat Makwana
Introduction to AngularJS By Bharat MakwanaIntroduction to AngularJS By Bharat Makwana
Introduction to AngularJS By Bharat Makwana
 
Nicolas Embleton, Advanced Angular JS
Nicolas Embleton, Advanced Angular JSNicolas Embleton, Advanced Angular JS
Nicolas Embleton, Advanced Angular JS
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directives
 
GDayX - Advanced Angular.JS
GDayX - Advanced Angular.JSGDayX - Advanced Angular.JS
GDayX - Advanced Angular.JS
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and concepts
 
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
AngularJS
AngularJSAngularJS
AngularJS
 
Foster - Getting started with Angular
Foster - Getting started with AngularFoster - Getting started with Angular
Foster - Getting started with Angular
 
Angular.js presentation
Angular.js presentationAngular.js presentation
Angular.js presentation
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
Angular js
Angular jsAngular js
Angular js
 
Angular.js for beginners
Angular.js for beginners Angular.js for beginners
Angular.js for beginners
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 

AngularJS Basics

  • 1. AngularJS Basic Building Blocks Prepared by Manaday Mavani April, 2016
  • 2. It is ● Frontend JavaScript MVC framework ● 100% JavaScript ● 100% client-side
  • 3. It is not ● JS Library ● DOM Manipulation Library like jQuery ● Just another templating system
  • 4. It helps in ● Single Page Applications ● Logical separation (MVC) ● Two way data binding ● Reusable components ● Templating ● Filters ● Form validations
  • 5. Basic Building Blocks ● Directives - Abstract instruction on HTML ● Modules - Collection ● Expressions - Templating mechanism to bind dynamic content ● Controllers - Business logic stuff ● $scope - Glue between View and Controller ● Services - Encapsulate related responsibilities ● Filters - Transform data ● Dependency Injection - Delegate responsibility to the injector
  • 6. Primary Directives ● ng-app ● ng-controller ● ng-model ● ng-repeat ● ng-include ● ng-change ● ng-class ● ng-show ● ng-hide ● ng-if ● ng-view ● ng-switch ● ng-click
  • 7. ng-app ● Provides auto-bootstrap ● Specify AngularJS module to be used as root module for the application ● Typically placed near root element ○ <html ng-app=”app-name”> OR <body ng-app=”app-name”> ● Can not be nested within another ng-app ● Example - http://plnkr.co/edit/0YNo7LZtkVJnY2iDl4QO?p=preview
  • 8. ng-controller ● Attaches a controller class to the view ● Declaration styles ○ as syntax: ng-controller=”SettingsController as settings” ○ $scope way: ng-controller=”SettingsController” ● Example: http://plnkr.co/edit/SPtMXwVPifnK2qGD0Bsf?p=preview
  • 9. ng-model ● Used for 2-way bindings for form elements like input, select, textarea ● <input type=”text” ng-model=”scope-prop” /> ● Example: http://plnkr.co/edit/Pf04Gkw8xaSZIPBQbNPg?p=preview
  • 10. ng-click ● Allows to specify custom behavior when clicked ● <button ng-click=”count = count + 1”>Increment</button> ● Example: http://plnkr.co/edit/l7LavHKpeXA2RQc47UDb?p=preview
  • 11. ng-include ● Fetches, compiles and includes an external HTML fragment ● Helps to abstract away the details ● <ng-include src="'PartialTemplate.html'" onload="expression"></ng-include> ● Example: http://plnkr.co/edit/A9Sj6pIDk4TDJytzwXth?p=preview
  • 12. ng-class ● To dynamically set CSS classes on HTML element by data binding expression ● ng-class operates in 3 different ways ○ If expression is string, it should be one or more space-delimited class names ○ If expression is object, it should like key-value pair where key represents class name ○ If expression is array, each element should either be a string or an object ● Examples: ○ Basic: http://plnkr.co/edit/A9Sj6pIDk4TDJytzwXth?p=preview ○ Advanced: http://plnkr.co/edit/67YGWFFN7h7SBTPXUREC?p=info
  • 13. Let’s Build: Github Viewer App ● Pages: Search, Repositories, Contributors ● You will learn ○ Basic app structure ○ Controllers implementation ○ Services to fetch data from API Endpoints ○ Routing ○ Sorting ● Source code on Github - https://github.com/ManadayM/ngGithubViewer
  • 14. Resources ● Shaping up with AngularJS by Codeschool ● AngularJS Fundamentals By Egghead.io ● A Better Way to Learn AngularJS by Thinkster ● AngularJS Blog Series by LosTechies ● AngularJS Masterclass on Udemy (Paid) ● Controller As Syntax ● $scope vs this ● Custom Directives ● AngularJS Styleguide by Johnpapa ● Promises by HTML5Rocks, Promises explained by Toptal
  • 15.