SlideShare a Scribd company logo
1 of 17
Angular 2
THE BASIC BUILDING BLOCKS OF ANGULAR 2 APPLICATIONS
OVERVIEW
 Angular 2 is a framework to help us build client applications in HTML and
either JavaScript or a language (like Dart or TypeScript).
 With Angular, we write applications by composing
 HTML templates with Angularized markup,
 writing component classes to manage those templates,
 adding application logic in services,
 and handing the top root component to Angular's bootstrapper.
Building blocks
 An Angular 2 for Dart application rests on seven main building blocks:
1. Components
2. Metadata
3. Templates
4. Data binding
5. Directives
6. Services
7. Dependency injection
ARCHITECTURE
Components
A component controls a patch of screen real estate that we could call a view
class HeroListComponent {
List<Hero> heroes;
Hero selectedHero;
HeroListComponent(HeroService heroService) {
heroes = heroService.getHeroes();
}
selectHero(Hero hero) {
selectedHero = hero;
}
}
Templates
We define a component's view with its companion template. A template is a
form of HTML that tells Angular how to render the component
<h2>Hero List</h2>
<div *ngFor="let hero of heroes"
(click)="selectHero(hero)">
{{hero.name}}
</div>
<hero-detail *ngIf="selectedHero != null"
[hero]="selectedHero"></hero-detail>
Component Tree
Metadata
Metadata tells Angular how to process a class.
@Component(
selector: 'hero-list',
templateUrl: 'hero_list_component.html',
styleUrls: const ['hero_list_component.css'],
directives: const [HeroDetailComponent],
providers: const [HeroService]
)
class HeroListComponent { ... }
 At runtime, Angular discovers the metadata specified by
the @Component annotation. That's how Angular learns
how to do "the right thing".
 The template, metadata, and component together
describe the view.
 We apply other metadata annotations in a similar fashion
to guide Angular behavior. @Injectable, @Input,
@Output, and @RouterConfig are a few of the more
popular annotations we'll master as our Angular
knowledge grows.
At runtime, Angular discovers the metadata specified by the @Component annotation. That's how Angular learns how to do "the right thing".
The architectural takeaway is that we must add metadata to our
code so that Angular knows what to do.
Data binding
Without a framework, we would be responsible for pushing data values into
the HTML controls and turning user responses into actions and value updates.
Angular supports data binding, a mechanism for
coordinating parts of a template with parts of a
component. We add binding markup to the
template HTML to tell Angular how to connect
both sides.
There are four forms of data binding syntax. Each
form has a direction — to the DOM, from the
DOM, or in both directions — as indicated by the
arrows in the diagram.
<div ... >{{hero.name}}</div> String Interpolation
DOM  Component
The {{hero.name}} Interpolation displays the
component's hero.name property value within
the <div> tags.
<hero-detail ...
[hero]="selectedHero"></hero-
detail>
Property Binding
DOM  Component
The [hero] property binding passes
the value of selectedHero from the
parent
<div ...
(click)="selectHero(hero)">...</div>
Event Binding
DOM  Component
The (click) event binding calls the
component's selectHero method
when the user clicks a hero's name.
<input
[(ngModel)]="hero.name"></div>
Two-way data binding
DOM  Component
Important fourth form that
combines property and event
binding in a single notation, using
the ngModel directive
Two-way data binding
Data binding is also important for communication between parent and child
components
Directives
A directive is a class with directive metadata. In Dart we apply the @Directive
annotation to attach metadata to the class.
 A component is a directive-with-a-template; a
@Component annotation is actually a
@Directive annotation extended with
template-oriented features.
 Two other kinds of directives exist: structural
and attribute directives.
 Structural directives alter layout by adding,
removing, and replacing elements in DOM.
 Attribute directives alter the appearance or
behavior of an existing element.
Structural Directives
<div *ngFor="let hero of heroes">
<h1> {{hero.name}}</h1>
</div>
<hero-detail *ngIf="selectedHero != null"
>
<h1> {{hero.name}}</h1>
</hero-detail>
Attribute Directives
<div>
<input [(ngModel)]="hero.name">
</div>
Services
Services is a broad category encompassing any value, function, or feature that
our application needs.
 Almost anything can be a service. A service is
typically a class with a narrow, well-defined
purpose. It should do something specific and
do it well.
 A component's job is to enable the user
experience and nothing more. It mediates
between the view (rendered by the template)
and the application logic (which often includes
some notion of a model).
Dependency injection
Dependency injection is a way to supply a new instance of a class with the
fully-formed dependencies it requires.
 Most dependencies are services. Angular uses
dependency injection to provide new
components with the services they need.
 Angular can tell which services a component
needs by looking at the types of its constructor
parameters.
 When Angular creates a component, it first
asks an injector for the services that the
component requires.
Angular features and services
 Animations:
 Bootstrap:
 Change detection:
 Component router:
 Events:
 Forms:
 HTTP:
 Lifecycle hooks:
 Pipes:

More Related Content

What's hot

AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation Phan Tuan
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Oleksii Prohonnyi
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2Dor Moshe
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questionsGoa App
 
The productive developer guide to Angular 2
The productive developer guide to Angular 2The productive developer guide to Angular 2
The productive developer guide to Angular 2Maurice De Beijer [MVP]
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript Rohit Bishnoi
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency InjectionNir Kaufman
 
Microservices in a netshell
Microservices in a netshellMicroservices in a netshell
Microservices in a netshellKnoldus Inc.
 
An introduction to Angular2
An introduction to Angular2 An introduction to Angular2
An introduction to Angular2 Apptension
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersOswald Campesato
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - ServicesNir Kaufman
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training Patrick Schroeder
 
Services Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJSServices Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJSSumanth krishna
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScriptAhmed El-Kady
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSKnoldus Inc.
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Naveen Pete
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Ahmed Moawad
 

What's hot (20)

AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0
 
AngularJS 2.0
AngularJS 2.0AngularJS 2.0
AngularJS 2.0
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
React render props
React render propsReact render props
React render props
 
The productive developer guide to Angular 2
The productive developer guide to Angular 2The productive developer guide to Angular 2
The productive developer guide to Angular 2
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency Injection
 
Microservices in a netshell
Microservices in a netshellMicroservices in a netshell
Microservices in a netshell
 
An introduction to Angular2
An introduction to Angular2 An introduction to Angular2
An introduction to Angular2
 
React js
React jsReact js
React js
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training
 
Services Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJSServices Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJS
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScript
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 

Viewers also liked

Introdução a linguagem de programação Lua
Introdução a linguagem de programação LuaIntrodução a linguagem de programação Lua
Introdução a linguagem de programação LuaLeonardo Soares
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Dawid Myslak
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introductionJonathan Holloway
 
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...Matt Raible
 
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017Matt Raible
 
Migrating your monolithic application for micro services with JHipster
Migrating your monolithic application for micro services with JHipsterMigrating your monolithic application for micro services with JHipster
Migrating your monolithic application for micro services with JHipsterLazaro Prates Junior
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017Matt Raible
 
Polymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimePolymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimeJuarez Filho
 
The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015Brandon Belvin
 
Apresentação Google I/O Extended Vitória
Apresentação Google I/O Extended VitóriaApresentação Google I/O Extended Vitória
Apresentação Google I/O Extended VitóriaFabiano Monte
 

Viewers also liked (20)

Introdução a linguagem de programação Lua
Introdução a linguagem de programação LuaIntrodução a linguagem de programação Lua
Introdução a linguagem de programação Lua
 
Angular 2
Angular 2Angular 2
Angular 2
 
GDG Angular 2
GDG Angular 2GDG Angular 2
GDG Angular 2
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Depuração de software
Depuração de softwareDepuração de software
Depuração de software
 
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
 
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
Building a PWA with Ionic, Angular and Spring Boot - Jfokus 2017
 
Migrating your monolithic application for micro services with JHipster
Migrating your monolithic application for micro services with JHipsterMigrating your monolithic application for micro services with JHipster
Migrating your monolithic application for micro services with JHipster
 
JHipster
JHipsterJHipster
JHipster
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
O futuro do Android
O futuro do AndroidO futuro do Android
O futuro do Android
 
Polymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimePolymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in Realtime
 
The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015
 
Angular js gtg-27feb2013
Angular js gtg-27feb2013Angular js gtg-27feb2013
Angular js gtg-27feb2013
 
Web components
Web componentsWeb components
Web components
 
Apresentação Google I/O Extended Vitória
Apresentação Google I/O Extended VitóriaApresentação Google I/O Extended Vitória
Apresentação Google I/O Extended Vitória
 
Polymer Starter Kit
Polymer Starter KitPolymer Starter Kit
Polymer Starter Kit
 

Similar to Angular 2

Similar to Angular 2 (20)

Angular2
Angular2Angular2
Angular2
 
Directives
DirectivesDirectives
Directives
 
Angular Basics.pptx
Angular Basics.pptxAngular Basics.pptx
Angular Basics.pptx
 
Angular Components.pptx
Angular Components.pptxAngular Components.pptx
Angular Components.pptx
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
Angular Directive.pptx
Angular Directive.pptxAngular Directive.pptx
Angular Directive.pptx
 
Angular2 and You
Angular2 and YouAngular2 and You
Angular2 and You
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
17612235.ppt
17612235.ppt17612235.ppt
17612235.ppt
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
 
Angular js
Angular jsAngular js
Angular js
 
Directives.pptx
Directives.pptxDirectives.pptx
Directives.pptx
 
introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
 
Html
HtmlHtml
Html
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
Html5 tutorial
Html5 tutorialHtml5 tutorial
Html5 tutorial
 
Html5 - Tutorial
Html5 - TutorialHtml5 - Tutorial
Html5 - Tutorial
 
Leveling up with AngularJS
Leveling up with AngularJSLeveling up with AngularJS
Leveling up with AngularJS
 
PPT on javascript ajax and css and some points related to server
PPT on javascript ajax and css and some points related to serverPPT on javascript ajax and css and some points related to server
PPT on javascript ajax and css and some points related to server
 
Web components
Web componentsWeb components
Web components
 

Recently uploaded

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Recently uploaded (20)

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

Angular 2

  • 1. Angular 2 THE BASIC BUILDING BLOCKS OF ANGULAR 2 APPLICATIONS
  • 2. OVERVIEW  Angular 2 is a framework to help us build client applications in HTML and either JavaScript or a language (like Dart or TypeScript).  With Angular, we write applications by composing  HTML templates with Angularized markup,  writing component classes to manage those templates,  adding application logic in services,  and handing the top root component to Angular's bootstrapper.
  • 3. Building blocks  An Angular 2 for Dart application rests on seven main building blocks: 1. Components 2. Metadata 3. Templates 4. Data binding 5. Directives 6. Services 7. Dependency injection
  • 5. Components A component controls a patch of screen real estate that we could call a view class HeroListComponent { List<Hero> heroes; Hero selectedHero; HeroListComponent(HeroService heroService) { heroes = heroService.getHeroes(); } selectHero(Hero hero) { selectedHero = hero; } }
  • 6. Templates We define a component's view with its companion template. A template is a form of HTML that tells Angular how to render the component <h2>Hero List</h2> <div *ngFor="let hero of heroes" (click)="selectHero(hero)"> {{hero.name}} </div> <hero-detail *ngIf="selectedHero != null" [hero]="selectedHero"></hero-detail>
  • 8. Metadata Metadata tells Angular how to process a class. @Component( selector: 'hero-list', templateUrl: 'hero_list_component.html', styleUrls: const ['hero_list_component.css'], directives: const [HeroDetailComponent], providers: const [HeroService] ) class HeroListComponent { ... }
  • 9.  At runtime, Angular discovers the metadata specified by the @Component annotation. That's how Angular learns how to do "the right thing".  The template, metadata, and component together describe the view.  We apply other metadata annotations in a similar fashion to guide Angular behavior. @Injectable, @Input, @Output, and @RouterConfig are a few of the more popular annotations we'll master as our Angular knowledge grows. At runtime, Angular discovers the metadata specified by the @Component annotation. That's how Angular learns how to do "the right thing". The architectural takeaway is that we must add metadata to our code so that Angular knows what to do.
  • 10. Data binding Without a framework, we would be responsible for pushing data values into the HTML controls and turning user responses into actions and value updates. Angular supports data binding, a mechanism for coordinating parts of a template with parts of a component. We add binding markup to the template HTML to tell Angular how to connect both sides. There are four forms of data binding syntax. Each form has a direction — to the DOM, from the DOM, or in both directions — as indicated by the arrows in the diagram.
  • 11. <div ... >{{hero.name}}</div> String Interpolation DOM  Component The {{hero.name}} Interpolation displays the component's hero.name property value within the <div> tags. <hero-detail ... [hero]="selectedHero"></hero- detail> Property Binding DOM  Component The [hero] property binding passes the value of selectedHero from the parent <div ... (click)="selectHero(hero)">...</div> Event Binding DOM  Component The (click) event binding calls the component's selectHero method when the user clicks a hero's name. <input [(ngModel)]="hero.name"></div> Two-way data binding DOM  Component Important fourth form that combines property and event binding in a single notation, using the ngModel directive
  • 12. Two-way data binding Data binding is also important for communication between parent and child components
  • 13. Directives A directive is a class with directive metadata. In Dart we apply the @Directive annotation to attach metadata to the class.  A component is a directive-with-a-template; a @Component annotation is actually a @Directive annotation extended with template-oriented features.  Two other kinds of directives exist: structural and attribute directives.  Structural directives alter layout by adding, removing, and replacing elements in DOM.  Attribute directives alter the appearance or behavior of an existing element.
  • 14. Structural Directives <div *ngFor="let hero of heroes"> <h1> {{hero.name}}</h1> </div> <hero-detail *ngIf="selectedHero != null" > <h1> {{hero.name}}</h1> </hero-detail> Attribute Directives <div> <input [(ngModel)]="hero.name"> </div>
  • 15. Services Services is a broad category encompassing any value, function, or feature that our application needs.  Almost anything can be a service. A service is typically a class with a narrow, well-defined purpose. It should do something specific and do it well.  A component's job is to enable the user experience and nothing more. It mediates between the view (rendered by the template) and the application logic (which often includes some notion of a model).
  • 16. Dependency injection Dependency injection is a way to supply a new instance of a class with the fully-formed dependencies it requires.  Most dependencies are services. Angular uses dependency injection to provide new components with the services they need.  Angular can tell which services a component needs by looking at the types of its constructor parameters.  When Angular creates a component, it first asks an injector for the services that the component requires.
  • 17. Angular features and services  Animations:  Bootstrap:  Change detection:  Component router:  Events:  Forms:  HTTP:  Lifecycle hooks:  Pipes: