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

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
+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
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 

Recently uploaded (20)

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
+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...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 

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: