SlideShare a Scribd company logo
ANGULAR 2.0
RELEASED ON 14TH SEPTEMBER, 2016 - GOOGLE
ANGULAR 2.0
• Development platform for building mobile and desktop web applications.
• Angular 2 is not an upgrade of 1. Its totally rewrite.
• Default language –Typescript
WHY ANGULAR 2.0?
• Component based.Modularization, reusability, maintainable, reliable.
• Mobile oriented. Learn once, write anywhere.
• Provides more choice for languages.ES5, ES6,Typescript or Dart.
• Powerful routes.Child/Nested routing.
• Dependency injection. Child injectors.
• Forms
BUILDING BLOCKS OF APPLICATION
1. Modules
2. Components
3. Templates
4. Metadata
5. Data Binding
6. Directives
7. Services
8. Dependency Injection
MODULE
• Angular app should have one root module.
• Conventionally named as appModule.
• Module class consists of NgModule decorator, function that takes a single metadata
object whose properties describe the module.
• Allows to register directives,components,service and many other things in a single place.
Ngmodule
• declaration
• exports
• imports
• providers
• bootstrap
NgModule
declarations
- List components,directives,pipes.
- Can declare in another module but just declare it once.
- Module classes,service classes,non-angular classes and objects are not required to
declare.
exports
- To make visible to another module.
- Export components,directives,pipes.
- If not export then visible only to other component declared in this module.
NgModule
imports
- List supporting modules for a component declared in this module.
providers
- List of dependency injection providers
bootstrap
- Only root module should set bootstrap property.
COMPONENTS
• Helps to render the view page.
• Controls the appearance and behavior of a view through its template.
• Component decorator, a function that takes a configuration object.
@Component({
selector:'hello-world',
template: `<div>Hello world</div>`
})
Template : <div><hello-world></hello-world></div>
Component
• selector
Name of the HTML tag.
• template
Placeholder for the HTML.
• templateUrl
Source for component template, separate HTML file.
Take relative path.
• Other metadata : directives, providers,styleUrls …
TEMPLATES
• A form HTML page.
• But have additional angular template syntax.
<p>The sum of 2 + 4 is {{2 + 4}}</p> Template expression
<h3> {{title}}</h3> Component property
<p>The sum of 2 + 4 is not {{2 + 4 + getValue()}}</p> Component Method
TEMPLATES
• One way data binding
• {{ }} => Interpolation.Display a component property,
• [ ] => Property binding. Bind the value to the property.
• ( ) => Event binding.
• [()] =>Two way data binding
METADATA
• Define how to process a class.
• Metadata answers the following questions.
• what is it?
• what does it need?
DATA BINDING
• Communication between a template and its component.Or between parent and child
components.
DATA BINDING
• BindingType (Divided based on the direction in which data flows)
1. Interpolation | property | attribute
One way from source to target.Data source =>View target.
{{expression}} => <h2>{{title}}</h2>
[target] = "expression" => <span [hidden] = “isSet” ></span>
2. Event
One way from target to source.View target => Data source.
(target) = "statement” => (click) = ‘callMe’
3. Two way
[(target)] = "expression” => [(ngModel)] = ‘callMe’
DIRECTIVES
• Transforms the DOM.
• Can create custom directive.
• Types :
1. Components
Directive with a template(mandatory).
2. Attribute Directive
Add appearance or behavior to an existing element.ngModel, ngSwitch
3. Structural Directive
Change the DOM layouts by adding/removing/replacing elements
Eg : ngFor, ngIf
SERVICES
• Services hold business logic for a component.
• Services are available to components through dependency injection.
DEPENDENCY INJECTION
• A way to supply a new instance of a class with the fully-formed dependencies it requires.
• Uses to provide the component with the services they need.
• Supports nested injectors in parallel with the component tree.
• No need to configure providers at each level.
DEPENDENCY INJECTION
Child injectors
ServiceA
ComponentA Component B
Root Component
DEPENDENCY INJECTION
@Component({
providers:[ProductService]
})
class ProductComponent {
product:Product;
constructor(private productService: ProductService) {
this.product = this.productService.getProduct();
}
}
OTHER FEATURES AND SERVICES
• Pipes
- Formatting and transformation the data in template.
- Built in pipes :currency,date, uppercase, Json,lowercase, decimal,percent.
- Custom pipe can be created.
Eg:
price | currency:'USD':true =====> 42.33 as $42.33
book.title | lowercase =====> AngularJs => angularjs
ROUTING
• It enables navigation from one view to the next as users perform application tasks.
• Three main components of Routing
• Route Object => Describes our application’s routes.
• RouterOutlet =>A placeholder component that gets expanded to each route’s content.
• RouterLink => Directive for binding a clickable HTML element to a route.
ROUTING
Routes = [
{path:'',redirectTo:'/home',pathMatch:'full'},
{path:'home',component:HomeComponent},
{path:contact/:id',component:ContactComponent}
ROUTING
<html><header></header><body>
<div id="menu”>
<a [routerLink]="['/home']" class="btn">Home</a>
<a [routerLink]="['/about']" class="btn">About</a>
</div>
<div id="container">
<router-outlet></router-outlet>
</div>
</body></html>
TYPESCRIPT
• Open source
• Developed by Microsoft
• Superset of JavaScript
• Has own compiler to convert javascript.
• Includes many aspects of object orientation.
• Inheritance,Interfaces,Generics, Lambdas
FUTURE PLANS
• Bug fixes and non-breaking features for APIs marked as stable
• More guides and live examples specific to your use cases
• More work on animations
• Angular Material 2
• MovingWebWorkers out of experimental
• More features and more languages for Angular Universal
• Even more speed and payload size improvements
NOTE
• Angular CLI provide a command line interface from initial project generation to
production deployment.
• https://cli.angular.io/)
• https://github.com/angular/angular-cli
REFERENCES
• https://github.com/angular
• https://www.typescriptlang.org/
THANK YOU

More Related Content

PPTX
Dataweave
PPT
Jdbc (database in java)
PPTX
Introduction to dataweave
PDF
Overview Of JDBC
PPT
Jdbc
PPT
Jdbc slide for beginers
PPTX
Understanding LINQ in C#
Dataweave
Jdbc (database in java)
Introduction to dataweave
Overview Of JDBC
Jdbc
Jdbc slide for beginers
Understanding LINQ in C#

What's hot (19)

PPT
PPSX
JDBC: java DataBase connectivity
PPT
Java database connectivity
PDF
Database and Java Database Connectivity
PPTX
DOC
JSP Scope variable And Data Sharing
PPTX
Core jdbc basics
PDF
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
PPTX
Hibernate ppt
PPT
Jdbc complete
PPTX
Spring (1)
PDF
Jeff Huber Portfoilio
PPT
JSP Processing
PPT
Hibernate presentation
PPTX
Java Database Connectivity (JDBC)
PPTX
Jsp tag library
PPTX
Database Access With JDBC
JDBC: java DataBase connectivity
Java database connectivity
Database and Java Database Connectivity
JSP Scope variable And Data Sharing
Core jdbc basics
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 6...
Hibernate ppt
Jdbc complete
Spring (1)
Jeff Huber Portfoilio
JSP Processing
Hibernate presentation
Java Database Connectivity (JDBC)
Jsp tag library
Database Access With JDBC
Ad

Similar to Angular2 (20)

PDF
better-apps-angular-2-day1.pdf and home
PPTX
What's new in Angular 2?
PPTX
Angular 2 with typescript
PPTX
Angular js 2
PPT
17612235.ppt
PPTX
Unit-III(Design).pptx
PPTX
Angular 9
PPTX
Angular js firebase-preso
PDF
70487.pdf
PPTX
Moving From AngularJS to Angular 2
PDF
Angular2 with type script
PDF
Building Blocks of Angular 2 and ASP.NET Core
PPTX
Unit 2 - Data Binding.pptx
PDF
MuleSoft Surat Virtual Meetup#28 - Exposing and Consuming SOAP Service - SOAP...
PDF
Angular2 with TypeScript
PDF
Angular 2 overview in 60 minutes
PPTX
Angular Basics.pptx
PPTX
AngularJS
DOC
better-apps-angular-2-day1.pdf and home
What's new in Angular 2?
Angular 2 with typescript
Angular js 2
17612235.ppt
Unit-III(Design).pptx
Angular 9
Angular js firebase-preso
70487.pdf
Moving From AngularJS to Angular 2
Angular2 with type script
Building Blocks of Angular 2 and ASP.NET Core
Unit 2 - Data Binding.pptx
MuleSoft Surat Virtual Meetup#28 - Exposing and Consuming SOAP Service - SOAP...
Angular2 with TypeScript
Angular 2 overview in 60 minutes
Angular Basics.pptx
AngularJS
Ad

Recently uploaded (20)

PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
web development for engineering and engineering
PDF
Digital Logic Computer Design lecture notes
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Sustainable Sites - Green Building Construction
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
Mechanical Engineering MATERIALS Selection
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Operating System & Kernel Study Guide-1 - converted.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
additive manufacturing of ss316l using mig welding
bas. eng. economics group 4 presentation 1.pptx
Internet of Things (IOT) - A guide to understanding
Foundation to blockchain - A guide to Blockchain Tech
Model Code of Practice - Construction Work - 21102022 .pdf
web development for engineering and engineering
Digital Logic Computer Design lecture notes
Automation-in-Manufacturing-Chapter-Introduction.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Sustainable Sites - Green Building Construction
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mechanical Engineering MATERIALS Selection

Angular2

  • 1. ANGULAR 2.0 RELEASED ON 14TH SEPTEMBER, 2016 - GOOGLE
  • 2. ANGULAR 2.0 • Development platform for building mobile and desktop web applications. • Angular 2 is not an upgrade of 1. Its totally rewrite. • Default language –Typescript
  • 3. WHY ANGULAR 2.0? • Component based.Modularization, reusability, maintainable, reliable. • Mobile oriented. Learn once, write anywhere. • Provides more choice for languages.ES5, ES6,Typescript or Dart. • Powerful routes.Child/Nested routing. • Dependency injection. Child injectors. • Forms
  • 4. BUILDING BLOCKS OF APPLICATION 1. Modules 2. Components 3. Templates 4. Metadata 5. Data Binding 6. Directives 7. Services 8. Dependency Injection
  • 5. MODULE • Angular app should have one root module. • Conventionally named as appModule. • Module class consists of NgModule decorator, function that takes a single metadata object whose properties describe the module. • Allows to register directives,components,service and many other things in a single place.
  • 6. Ngmodule • declaration • exports • imports • providers • bootstrap
  • 7. NgModule declarations - List components,directives,pipes. - Can declare in another module but just declare it once. - Module classes,service classes,non-angular classes and objects are not required to declare. exports - To make visible to another module. - Export components,directives,pipes. - If not export then visible only to other component declared in this module.
  • 8. NgModule imports - List supporting modules for a component declared in this module. providers - List of dependency injection providers bootstrap - Only root module should set bootstrap property.
  • 9. COMPONENTS • Helps to render the view page. • Controls the appearance and behavior of a view through its template. • Component decorator, a function that takes a configuration object. @Component({ selector:'hello-world', template: `<div>Hello world</div>` }) Template : <div><hello-world></hello-world></div>
  • 10. Component • selector Name of the HTML tag. • template Placeholder for the HTML. • templateUrl Source for component template, separate HTML file. Take relative path. • Other metadata : directives, providers,styleUrls …
  • 11. TEMPLATES • A form HTML page. • But have additional angular template syntax. <p>The sum of 2 + 4 is {{2 + 4}}</p> Template expression <h3> {{title}}</h3> Component property <p>The sum of 2 + 4 is not {{2 + 4 + getValue()}}</p> Component Method
  • 12. TEMPLATES • One way data binding • {{ }} => Interpolation.Display a component property, • [ ] => Property binding. Bind the value to the property. • ( ) => Event binding. • [()] =>Two way data binding
  • 13. METADATA • Define how to process a class. • Metadata answers the following questions. • what is it? • what does it need?
  • 14. DATA BINDING • Communication between a template and its component.Or between parent and child components.
  • 15. DATA BINDING • BindingType (Divided based on the direction in which data flows) 1. Interpolation | property | attribute One way from source to target.Data source =>View target. {{expression}} => <h2>{{title}}</h2> [target] = "expression" => <span [hidden] = “isSet” ></span> 2. Event One way from target to source.View target => Data source. (target) = "statement” => (click) = ‘callMe’ 3. Two way [(target)] = "expression” => [(ngModel)] = ‘callMe’
  • 16. DIRECTIVES • Transforms the DOM. • Can create custom directive. • Types : 1. Components Directive with a template(mandatory). 2. Attribute Directive Add appearance or behavior to an existing element.ngModel, ngSwitch 3. Structural Directive Change the DOM layouts by adding/removing/replacing elements Eg : ngFor, ngIf
  • 17. SERVICES • Services hold business logic for a component. • Services are available to components through dependency injection.
  • 18. DEPENDENCY INJECTION • A way to supply a new instance of a class with the fully-formed dependencies it requires. • Uses to provide the component with the services they need. • Supports nested injectors in parallel with the component tree. • No need to configure providers at each level.
  • 20. DEPENDENCY INJECTION @Component({ providers:[ProductService] }) class ProductComponent { product:Product; constructor(private productService: ProductService) { this.product = this.productService.getProduct(); } }
  • 21. OTHER FEATURES AND SERVICES • Pipes - Formatting and transformation the data in template. - Built in pipes :currency,date, uppercase, Json,lowercase, decimal,percent. - Custom pipe can be created. Eg: price | currency:'USD':true =====> 42.33 as $42.33 book.title | lowercase =====> AngularJs => angularjs
  • 22. ROUTING • It enables navigation from one view to the next as users perform application tasks. • Three main components of Routing • Route Object => Describes our application’s routes. • RouterOutlet =>A placeholder component that gets expanded to each route’s content. • RouterLink => Directive for binding a clickable HTML element to a route.
  • 24. ROUTING <html><header></header><body> <div id="menu”> <a [routerLink]="['/home']" class="btn">Home</a> <a [routerLink]="['/about']" class="btn">About</a> </div> <div id="container"> <router-outlet></router-outlet> </div> </body></html>
  • 25. TYPESCRIPT • Open source • Developed by Microsoft • Superset of JavaScript • Has own compiler to convert javascript. • Includes many aspects of object orientation. • Inheritance,Interfaces,Generics, Lambdas
  • 26. FUTURE PLANS • Bug fixes and non-breaking features for APIs marked as stable • More guides and live examples specific to your use cases • More work on animations • Angular Material 2 • MovingWebWorkers out of experimental • More features and more languages for Angular Universal • Even more speed and payload size improvements
  • 27. NOTE • Angular CLI provide a command line interface from initial project generation to production deployment. • https://cli.angular.io/) • https://github.com/angular/angular-cli