SlideShare a Scribd company logo
AN EVENINGWITH
ANGULAR 2
Michael Melusky - @mrjavascript
Central Penn .NET User Group
January 17, 2017
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 ???
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
Angular 2
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!”
MVW ????
Pre-requisites
■ NPM (node package manager)
■ HTML5/CSS3
■ JavaScript /TypeScript
Node.js
Node.js
■ To verify Node installation:
– node – v
Angular CLI
■ To create anAngular 2 application:
– Install the Angular 2 CLI:
■ npm install –g angular-cli
■ ng new <app-name>
TypeScript
TypeScript Basics
■ Similar to JavaScript (strict-superset)
– Open source language developed by Microsoft
■ Adds static types
■ Adds class-based object-oriented programming
TypeScript Basics
■ In JavaScript:
– foo = “my string”
– foo = 25
■ Not allowed inTypeScript:
– foo = “my string”
– foo = 25
TypeScriptVariable Declaration
■ foo:string = “hi there”
■ foo:number = 69
■ foo:boolean = false
■ foo:any
■ foo = 42
■ foo:string[]
TypeScript Classes
■ class Planet {
– moons:number = 50
– orbit {
■ console.log(“rotating around the sun”)
– }
■ }
■ pluto:Planet = new Planet()
TypeScript Constructor
■ class Planet {
– moons:number;
– constructor(numMoons:number) {
■ this.moons = numMoons;
– }
■ }
■ pluto:Planet = new Planet(1)
Angular 2 Components
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)
Angular Components
Angular Components
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
Data Binding
Angular 2 Data Binding
■ Bind from Component toTemplate
■ Bind fromTemplate to Component
Angular Data Binding
OneWay Binding
■ Data IntoView
■ string interpolation
■ {{title}} (always resolves to a string)
■ property binding
■ <input [required]='expression'>
OneWay Data Binding
■ Data Out ofView
■ event binding
■ <button (click)='expression/function'>
■ component class can handle the event
TwoWay Binding
■ <input [(ngModel)]='model/object'>
■ updates model in component class
■ updates any reference to model in view/template {{model}}
Communication Between Components
@Input Directive
■ Send data from the app to the home components (as example)
■ Custom property binding
@Output Directive
■ Receive Events occurring in Home Component in App Component
■ Custom Event Binding
Angular 2 Routing
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
Angular 2 Directives
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)
Angular 2 Pipes
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!
Services
Services
■ Don’t RepeatYourself!
■ Component 1:
– Does some stuff
– Connects to the database
■ Component 2
– Does a few things
– Connects to the database’
Firebase
Firebase
■ Google product
ThankYou
Slide Notes
■ Code:
– Github.com/mrjavascript
■ Slides:
– Slideshare.com/mrjavascript
■ Thank you:
– “The Net Ninja” onYouTube for topic arrangements

More Related Content

PPTX
Autolab Workshop
PPTX
ruby-on-rails-and-ember-cli
PPTX
Demistifying the 3D Web - part 2
PPTX
Introduction to Ruby on Rails
PDF
Dynamic input tables lwc vs aura vs. visualforce
PPT
Angularjs for kolkata drupal meetup
PPTX
Local Lambda Debugging
PPTX
Securing your azure web app with asp.net core data protection
Autolab Workshop
ruby-on-rails-and-ember-cli
Demistifying the 3D Web - part 2
Introduction to Ruby on Rails
Dynamic input tables lwc vs aura vs. visualforce
Angularjs for kolkata drupal meetup
Local Lambda Debugging
Securing your azure web app with asp.net core data protection

Viewers also liked (20)

PPTX
Fun with lambda expressions
PDF
Power Bi and Power Bi Embedded for .Net Developers
PDF
An Intro to Angular 2
PPTX
Building Native “apps” with Visual Studio 2015
PPTX
Fun with lambda expressions
PPTX
Ember.js and .NET Integration
PPTX
Emberjs and ASP.NET
PPTX
Fun with windows services
PPTX
An evening with querydsl
PDF
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
PDF
Getting started with Angular CLI
PDF
Getting Started with the Angular 2 CLI
PPTX
Introducing Power BI Embedded
PDF
Creating BananaJS with Angular 2, Angular CLI, and Material Design
PPT
Animism
PPTX
Power BI Single Page Applications Boise Code Camp 2017
PPTX
An afternoon with angular 2
PPT
Urogenital system chap
PPTX
Power BI Made Simple
Fun with lambda expressions
Power Bi and Power Bi Embedded for .Net Developers
An Intro to Angular 2
Building Native “apps” with Visual Studio 2015
Fun with lambda expressions
Ember.js and .NET Integration
Emberjs and ASP.NET
Fun with windows services
An evening with querydsl
Creating an Angular 2 Angular CLI app in 15 Minutes Using MaterializeCSS & Fi...
Getting started with Angular CLI
Getting Started with the Angular 2 CLI
Introducing Power BI Embedded
Creating BananaJS with Angular 2, Angular CLI, and Material Design
Animism
Power BI Single Page Applications Boise Code Camp 2017
An afternoon with angular 2
Urogenital system chap
Power BI Made Simple
Ad

Similar to An evening with Angular 2 (20)

PDF
Modern Perl Web Development with Dancer
PDF
Angular 2 overview in 60 minutes
PDF
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
ODP
Best episode ever: Angular 2 from the perspective of an Angular 1 developer
PPTX
Moving From AngularJS to Angular 2
PDF
New World of Angular (v2+)
PPTX
Introduction to angular 2
PDF
Angular2 - A story from the trenches
PDF
Building Blocks of Angular 2 and ASP.NET Core
PPTX
Foster - Getting started with Angular
PDF
Angular meetup 2 2019-08-29
PDF
Struts 2 In Action 1st Edition Don Brown Chad Michael Davis Scott Stanlick
PDF
Microservices @ Work - A Practice Report of Developing Microservices
ODP
Web dynpro
PPTX
Migrating an Application from Angular 1 to Angular 2
PPTX
Presentation on angular 5
PDF
Workshop 14: AngularJS Parte III
PDF
PDF
ITB_2023_CBWire_v3_Grant_Copley.pdf
PDF
Quick introduction to Angular 4 for AngularJS 1.5 developers
Modern Perl Web Development with Dancer
Angular 2 overview in 60 minutes
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
Best episode ever: Angular 2 from the perspective of an Angular 1 developer
Moving From AngularJS to Angular 2
New World of Angular (v2+)
Introduction to angular 2
Angular2 - A story from the trenches
Building Blocks of Angular 2 and ASP.NET Core
Foster - Getting started with Angular
Angular meetup 2 2019-08-29
Struts 2 In Action 1st Edition Don Brown Chad Michael Davis Scott Stanlick
Microservices @ Work - A Practice Report of Developing Microservices
Web dynpro
Migrating an Application from Angular 1 to Angular 2
Presentation on angular 5
Workshop 14: AngularJS Parte III
ITB_2023_CBWire_v3_Grant_Copley.pdf
Quick introduction to Angular 4 for AngularJS 1.5 developers
Ad

More from Mike Melusky (13)

PPTX
Container Orchestration for .NET Developers
PPTX
Containerize all the things!
PPTX
Building a Google Cloud Firestore API with dotnet core
PPTX
Effective .NET Core Unit Testing with SQLite and Dapper
PPTX
Effective .NET Core Unit Testing with SQLite and Dapper
PPTX
Reactive Web Development with Spring Boot 2
PPTX
Building xamarin.forms apps with prism and mvvm
PPTX
Introduction to react native with redux
PPTX
Xamarin.Forms Bootcamp
PPTX
An evening with React Native
PPTX
Progressive Web Apps and React
PPTX
Into to Docker (Central PA Java User Group - 8/14/2017)
ODP
Philly.NET Code Camp 2014.1
Container Orchestration for .NET Developers
Containerize all the things!
Building a Google Cloud Firestore API with dotnet core
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
Reactive Web Development with Spring Boot 2
Building xamarin.forms apps with prism and mvvm
Introduction to react native with redux
Xamarin.Forms Bootcamp
An evening with React Native
Progressive Web Apps and React
Into to Docker (Central PA Java User Group - 8/14/2017)
Philly.NET Code Camp 2014.1

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Machine Learning_overview_presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
gpt5_lecture_notes_comprehensive_20250812015547.pdf
The AUB Centre for AI in Media Proposal.docx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Machine Learning_overview_presentation.pptx
NewMind AI Weekly Chronicles - August'25-Week II
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Programs and apps: productivity, graphics, security and other tools
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
A Presentation on Artificial Intelligence
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

An evening with Angular 2