2. About Speaker
■ Michael Melusky
– Software Engineer for Audacious Inquiry in Baltimore MD
– Computer Science Professor
■ Penn State University
■ Franklin and Marshall College
– Hopeful 2017 Microsoft MVP ???
3. Topics
■ Introduction to Angular 2
■ TypeScript
■ Angular Components
■ Data Binding
– OneWay (View ->Component andComponent ->View)
– TwoWay
■ Passing Data Between Components
■ Routing
■ Directives
■ Pipes and Filters
■ Services and HTTP Service
■ Firebase Integration
5. What is Angular 2?
■ JavaScript framework for creating dynamic web applications
■ Component Based (unlike MVC)
– Significantly different an Angular 1.x
■ UsesTypeScript
■ From Google, “Superheroic JavaScript MVW Framework!”
12. TypeScript Basics
■ Similar to JavaScript (strict-superset)
– Open source language developed by Microsoft
■ Adds static types
■ Adds class-based object-oriented programming
18. Angular 2 Components
■ The main way to build elements and specify logic on a page
■ To create a component using the Angular CLI:
– Npm generate component <component-name>
■ A component is one type of an Angular 2 Directive (directives with templates)
21. ng-content Directive
■ Implement transclusion in Angular 2
■ Taking content from a text node or HTML
■ Injecting it into a template at an entry point
32. Routing
■ For instance:
– /home -> use home component
– /directory -> use directory component
■ To accomplish this:
– Create a route structure
– Tell Angular where to load the view when a route is requested
34. Angular 2 Directives
■ - instructions which tell Angular to do something
■ - e.g. <router-outlet></router-outlet>
■ - Attribute –
– interact with element its sitting on to change its properties (ngClass, ngStyle)
■ - Structural –
– change structure of HTML code (ngif, ngFor)
36. Angular 2 Pipes
■ - Used to be filters inAngular 1.x
■ - e.g. {{name | uppercase}}
■ - e.g. {{name | slice:1}}
■
■ - Filter pipe not in Angular 2
■ Can create custom pipes however!
38. Services
■ Don’t RepeatYourself!
■ Component 1:
– Does some stuff
– Connects to the database
■ Component 2
– Does a few things
– Connects to the database’