SlideShare a Scribd company logo
1 of 51
Download to read offline
Exploring
Angular 2
Ahmed Moawad
Course Prerequisites
<HTML
CSS} JavaScript
Course Objectives
Learn about Angular 2 and
it amazing features
Learn how to treat the web app as set
of blocks that integrate with each other
What is Angular 2 ?
AngularJS is a structural framework for dynamic web apps
extend HTML's syntax to express your
application's components.
eliminate much of the code you
would otherwise have to write.
It just a new language
TypeScript
Variable Declaration TypeScript
identifier : type = value
var name: string = “Ahmed”
let age: number = 17
let isStudent: boolean = True
var salary: any = “1900”
let
var
Data Types TypeScript
string
number
boolean
Array
any
void
null
undefined
Functions TypeScript
function add(x: number, y: number): number{
return x + y;
}
Classes TypeScript
class Animal {
private name: string;
constructor(aname: string) {
this.name = aname;
}
move(distanceInMeters: number = 0)
{}
static doStatic()
{}
}
class Horse extends Animal {
constructor(name: string) { super(name);}
}
Modules TypeScript
export function sum (x, y) {
return x + y
}
export var dept = “OS”
import * as i from “index”;
console.log(i.dept);
//OR
import {sum} from “index”;
sum(1,2);
index.ts home.ts
Let’s go back to
Angular 2
Architecture
Big Picture Architecture
Component
{}
Template
</>
Injector
Directives
Metadata
Metadata
Property Binding
Event Binding
Service
Structural Directive
Component Directive
Attribute Directive
The basic unit of Angular 2
Components
Intro Components
A component controls a patch of screen called a view.
Angular 2 App is constructed of components that integrate with each other.
Component
{}
Metadata
Decorator Components
@Component({
//Metadata Properties
})
export class AppComponent{
//The Component Class
}
Component decorator allows you to mark a class as an Angular component and provide
additional metadata that determines how the component should be processed, instantiated
and used at runtime.
Metadata Properties Components
@Component({
selector: “app-comp”
})
export class AppComponent{}
Metadata Properties are the data that Angular 2 use to prepare the Component
selector
template
templateUrl
styles
Declare the name that we select the component by in html.
Declare the component inline-defined html template.
-Declare the url of html file that contain the template.
Declare the component inline-defined style.
styleUrls -Declare the list of urls of style files that applied on the view.
Class Components
@Component({
selector: “app-comp”
template: `<p>Hello World</p>`
})
export class AppComponent{
name: string = “Ahmed”;
}
Class is the blue print of the Component that Angular 2 will insatiate the Component from.
Naming Conventions Components
@Component({
selector: “app-comp”
template: `<p>Hello World</p>`
})
export class AppComponent{
name: string = “Ahmed”;
}
File: <Component Name>.component.ts
Class: <Component Name>Component
app.component.ts
Hello World Component * Components
import { Component } from '@angular/core';
@Component({
selector: “app-comp”
template: `<p>Hello {{name}}!</p>`
})
export class AppComponent{ name: string = “Ahmed”; }
<html>
<body>
<app-comp></app-comp>
</body>
</html>
Hello Ahmed
app.component.ts
index.html Output
*For creating new Angular App, follow the installation instructions at the last section of the slides
The View of the Component
Templates
Intro Templates
A template is a form of HTML that tells Angular how to render the component.
Template
</>
Naming Conventions Templates
<p>Age: {{ age }}</p>
File: <Component Name>.component.html
app.component.html
Expressions Templates
{{ expression }}
A template expression produces a value.
Angular executes the expression and assigns it to a property of a binding target
Template Expressions look like JavaScript Expressions except that we cant use the following:
1. assignment operators (=, += , -=).
2. new operator.
3. ; or , .
4. increment (++) or decrement operators (- -) .
Example Templates
@Component({
selector: “app-comp”
templateUrl: “./app.html”
})
export class AppComponent{
age: number = 13;
}
<html>
<body>
<app-comp></app-comp>
</body>
</html>
Age: 28
app.component.ts
index.html Output
<p>Age: {{age+15}}</p>
app.component.html
Templates
Data Binding
Types Data Binding
Binding
[({})]
One-way Binding Two-way Binding
From Component
to View
From View to
Component
ngModel
Interpolation Property
ClassStyle Attribute
Events
Interpolation Data Binding
{{ expression }}
Example
@Component({ .... })
export class AppComponent{
name: string = “Open Source”;
....
}
<p> Hello, {{name}} </p>
app.component.html
Hello, Open Source
app.component.ts
Property Binding Data Binding
[property] = "expression"
Example
@Component({ .... })
export class AppComponent{
imageUrl: string = “kiwi-juice.png”;
....
}
app.component.ts
<img [src]=“imageUrl” />
app.component.html
Attribute Binding Data Binding
[attr.<attr-name>] = "expression"
Example
@Component({ .... })
export class AppComponent{
imageUrl: string = “kiwi-juice.png”;
....
}
app.component.ts
<img [attr.src]=“imageUrl” />
app.component.html
Style Binding Data Binding
[style.<style-name>] = "expression"
Example
@Component({ .... })
export class AppComponent{
bg: string= “#ff0000”;
....
}
app.component.ts
<div [style.background]=“bg”></div>
app.component.html
Class Binding Data Binding
[class.<class-name>] = "expression"
Example
@Component({ .... })
export class AppComponent{
isHidden: boolean= true;
....
}
app.component.ts
<div [class.hide]=“isHidden”></div>
app.component.html
Event Binding Data Binding
(event) = “statement"
Example
@Component({ .... })
export class AppComponent{
save(){
console.log(“Saved”);
}
}
<button (click)=“save()”>Save</button>
app.component.html
Save
Saved
console
app.component.ts
Prestige
$event Event Binding
Example
export class AppComponent{
movie=“Prestige”;
changeIt(m){
this.movie= m;
}
}
<input (input)=“changeIt($event.target.value)”>
<p>{{movie}}</p>
app.component.html
app.component.ts
$event is the Event Object that contains all the data of the Event Occurs to the target
Up
Up
ngModel
[(ngModel)] = “expression”
Two-way Binding
Prestige
Example
export class AppComponent{
movie=“Prestige”;
}
<input [(ngModel)]=“movie”>
<p>{{movie}}</p>
app.component.html
app.component.ts
Up
Up
It helps you when you need it
Modules
Intro Modules
Modules help organize an application into cohesive blocks of functionality.
Modules
App Module Modules
imports
-Import the modules that you need in your App.
Example: BrowserModule
declarations
Declare the components and directives that belong to your angular
App.
bootstrap -Declare the bootstrap component that your application.
Every Angular app has a root module class. By convention, the root module class is called
AppModule and it exists in a file named app.module.ts.
@NgModule({
imports: [],
declarations: [],
bootstrap: []
})
export class AppModule{}
Let’s Collect ’em all
Bootstrap Your App
Main Bootstrap Your App
import { platformBrowserDynamic } from '@angular/platform-
browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
main.ts
Lab Assignments
If you have Syntax Error, Solve it yourself. You are able to do that.1
Mentors exist to guide you to the best way to solve the problem not to solve the
problem or your syntax errors.
2
Steps of Solving the problem:
- Think.
- Think again.
- Use Pen and Papers to convert your thoughts into Procedures.
- Convert your previous pseudo code into JavaScript Code using
its syntax rules.
- Don’t be afraid of syntax errors. It is easy to solve. Read it clearly
and you will solve it.
- Check the output of every step you do and then check them all.
3
The most important rule is to enjoy challenging yourself and don’t stress your mind by the
headache of assignments delivery’s deadlines.
4
Rules
Angular Installation
Windows Node & NPM Installation
Website: https://www.nodejs.org
Download the convenient Node version from the official website:1
Run the executable file downloaded and follow the instructions2
Check Node and npm version:3
$ node –v
$ npm -v
Linux Node & NPM Installation
Run the following commands
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ node –v
$ npm –v
Angular CLI Angular Installation
Install Angular CLI
$ npm install -g @angular/cli
$ ng new os-app
$ cd os-app
$ ng serve
Now App serve at localhost:4200
LAB Beginner
Movies DB App : Static Movie Example
Moon Light
Director: Barry Jenkins
Writer: Tarell Alvin McCraney
Actors:
Mahershala Ali,
Shariff Earp,
Duan Sanderson
7.8
LAB Intermediate
Movies DB App : Edit person Example
Moon Light
Director: Barry Jenkins
Writer: Tarell Alvin McCraney
Actors:
Mahershala Ali,
Shariff Earp,
Duan Sanderson
7.8
Name
Nationality
Rating
4.5
4.5
I’m Ahmed. I’m from Egypt
LAB Advanced
Movies DB App : Change Movie Example
Name
Nationality
Rating 4.5
I’m Ahmed. I’m from Egypt
4.5
Manchester by Sea
Director: Kenneth Lonergan
Writer: Kenneth Lonergan
Stars:
Casey Affleck,
Michelle Williams,
Kyle Chandler
8
Flash
For the first one that who has completed the
required assignments
Captain America
For the one who has the minimum syntax
errors and his code is well organized
Iron Man
For the one who has the most generic
and strong code
Thor
For the one who find the best and
shortest way to solve the problems
LAB Badges
Thank You
ahmedmowd@gmail.com
To be continued … in the next level

More Related Content

What's hot

Angular js 2
Angular js 2Angular js 2
Angular js 2Ran Wahle
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developersYakov Fain
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersPaweł Żurowski
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Naveen Pete
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersOswald Campesato
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java DevelopersYakov Fain
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework Yakov Fain
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Sumanth Chinthagunta
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScriptYakov Fain
 
Data Flow Patterns in Angular 2 - Sebastian Müller
Data Flow Patterns in Angular 2 -  Sebastian MüllerData Flow Patterns in Angular 2 -  Sebastian Müller
Data Flow Patterns in Angular 2 - Sebastian MüllerSebastian Holstein
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java DevelopersYakov Fain
 
Angular 2: core concepts
Angular 2: core conceptsAngular 2: core concepts
Angular 2: core conceptsCodemotion
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsYakov Fain
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?jbandi
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascriptRan Wahle
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application TestingTroy Miles
 

What's hot (20)

Angular 5
Angular 5Angular 5
Angular 5
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Angular2 for Beginners
Angular2 for BeginnersAngular2 for Beginners
Angular2 for Beginners
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Angular 2
Angular 2Angular 2
Angular 2
 
Data Flow Patterns in Angular 2 - Sebastian Müller
Data Flow Patterns in Angular 2 -  Sebastian MüllerData Flow Patterns in Angular 2 -  Sebastian Müller
Data Flow Patterns in Angular 2 - Sebastian Müller
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
 
Angular 2: core concepts
Angular 2: core conceptsAngular 2: core concepts
Angular 2: core concepts
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascript
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
 

Similar to Exploring Angular 2 - Episode 1

Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Ontico
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesDavid Giard
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java DevelopersYakov Fain
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in AngularYadong Xie
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkRapidValue
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Jeado Ko
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 WebFrameworks
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentationdharisk
 
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Frost
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 
A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019Matt Raible
 
Angular Notes.pdf
Angular Notes.pdfAngular Notes.pdf
Angular Notes.pdfsagarpal60
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2Paras Mendiratta
 
Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applicationsAstrails
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsDigamber Singh
 
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019Matt Raible
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting startedTejinderMakkar
 

Similar to Exploring Angular 2 - Episode 1 (20)

Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web Services
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in Angular
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점 Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
 
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 
A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019
 
Angular Notes.pdf
Angular Notes.pdfAngular Notes.pdf
Angular Notes.pdf
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
 
Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applications
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
 
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
 

Recently uploaded

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
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.
 
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.
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 

Recently uploaded (20)

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
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...
 
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 ...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 

Exploring Angular 2 - Episode 1

  • 3. Course Objectives Learn about Angular 2 and it amazing features Learn how to treat the web app as set of blocks that integrate with each other
  • 4. What is Angular 2 ? AngularJS is a structural framework for dynamic web apps extend HTML's syntax to express your application's components. eliminate much of the code you would otherwise have to write.
  • 5. It just a new language TypeScript
  • 6. Variable Declaration TypeScript identifier : type = value var name: string = “Ahmed” let age: number = 17 let isStudent: boolean = True var salary: any = “1900” let var
  • 8. Functions TypeScript function add(x: number, y: number): number{ return x + y; }
  • 9. Classes TypeScript class Animal { private name: string; constructor(aname: string) { this.name = aname; } move(distanceInMeters: number = 0) {} static doStatic() {} } class Horse extends Animal { constructor(name: string) { super(name);} }
  • 10. Modules TypeScript export function sum (x, y) { return x + y } export var dept = “OS” import * as i from “index”; console.log(i.dept); //OR import {sum} from “index”; sum(1,2); index.ts home.ts
  • 11. Let’s go back to Angular 2
  • 13. Big Picture Architecture Component {} Template </> Injector Directives Metadata Metadata Property Binding Event Binding Service Structural Directive Component Directive Attribute Directive
  • 14. The basic unit of Angular 2 Components
  • 15. Intro Components A component controls a patch of screen called a view. Angular 2 App is constructed of components that integrate with each other. Component {} Metadata
  • 16. Decorator Components @Component({ //Metadata Properties }) export class AppComponent{ //The Component Class } Component decorator allows you to mark a class as an Angular component and provide additional metadata that determines how the component should be processed, instantiated and used at runtime.
  • 17. Metadata Properties Components @Component({ selector: “app-comp” }) export class AppComponent{} Metadata Properties are the data that Angular 2 use to prepare the Component selector template templateUrl styles Declare the name that we select the component by in html. Declare the component inline-defined html template. -Declare the url of html file that contain the template. Declare the component inline-defined style. styleUrls -Declare the list of urls of style files that applied on the view.
  • 18. Class Components @Component({ selector: “app-comp” template: `<p>Hello World</p>` }) export class AppComponent{ name: string = “Ahmed”; } Class is the blue print of the Component that Angular 2 will insatiate the Component from.
  • 19. Naming Conventions Components @Component({ selector: “app-comp” template: `<p>Hello World</p>` }) export class AppComponent{ name: string = “Ahmed”; } File: <Component Name>.component.ts Class: <Component Name>Component app.component.ts
  • 20. Hello World Component * Components import { Component } from '@angular/core'; @Component({ selector: “app-comp” template: `<p>Hello {{name}}!</p>` }) export class AppComponent{ name: string = “Ahmed”; } <html> <body> <app-comp></app-comp> </body> </html> Hello Ahmed app.component.ts index.html Output *For creating new Angular App, follow the installation instructions at the last section of the slides
  • 21. The View of the Component Templates
  • 22. Intro Templates A template is a form of HTML that tells Angular how to render the component. Template </>
  • 23. Naming Conventions Templates <p>Age: {{ age }}</p> File: <Component Name>.component.html app.component.html
  • 24. Expressions Templates {{ expression }} A template expression produces a value. Angular executes the expression and assigns it to a property of a binding target Template Expressions look like JavaScript Expressions except that we cant use the following: 1. assignment operators (=, += , -=). 2. new operator. 3. ; or , . 4. increment (++) or decrement operators (- -) .
  • 25. Example Templates @Component({ selector: “app-comp” templateUrl: “./app.html” }) export class AppComponent{ age: number = 13; } <html> <body> <app-comp></app-comp> </body> </html> Age: 28 app.component.ts index.html Output <p>Age: {{age+15}}</p> app.component.html
  • 27. Types Data Binding Binding [({})] One-way Binding Two-way Binding From Component to View From View to Component ngModel Interpolation Property ClassStyle Attribute Events
  • 28. Interpolation Data Binding {{ expression }} Example @Component({ .... }) export class AppComponent{ name: string = “Open Source”; .... } <p> Hello, {{name}} </p> app.component.html Hello, Open Source app.component.ts
  • 29. Property Binding Data Binding [property] = "expression" Example @Component({ .... }) export class AppComponent{ imageUrl: string = “kiwi-juice.png”; .... } app.component.ts <img [src]=“imageUrl” /> app.component.html
  • 30. Attribute Binding Data Binding [attr.<attr-name>] = "expression" Example @Component({ .... }) export class AppComponent{ imageUrl: string = “kiwi-juice.png”; .... } app.component.ts <img [attr.src]=“imageUrl” /> app.component.html
  • 31. Style Binding Data Binding [style.<style-name>] = "expression" Example @Component({ .... }) export class AppComponent{ bg: string= “#ff0000”; .... } app.component.ts <div [style.background]=“bg”></div> app.component.html
  • 32. Class Binding Data Binding [class.<class-name>] = "expression" Example @Component({ .... }) export class AppComponent{ isHidden: boolean= true; .... } app.component.ts <div [class.hide]=“isHidden”></div> app.component.html
  • 33. Event Binding Data Binding (event) = “statement" Example @Component({ .... }) export class AppComponent{ save(){ console.log(“Saved”); } } <button (click)=“save()”>Save</button> app.component.html Save Saved console app.component.ts
  • 34. Prestige $event Event Binding Example export class AppComponent{ movie=“Prestige”; changeIt(m){ this.movie= m; } } <input (input)=“changeIt($event.target.value)”> <p>{{movie}}</p> app.component.html app.component.ts $event is the Event Object that contains all the data of the Event Occurs to the target Up Up
  • 35. ngModel [(ngModel)] = “expression” Two-way Binding Prestige Example export class AppComponent{ movie=“Prestige”; } <input [(ngModel)]=“movie”> <p>{{movie}}</p> app.component.html app.component.ts Up Up
  • 36. It helps you when you need it Modules
  • 37. Intro Modules Modules help organize an application into cohesive blocks of functionality. Modules
  • 38. App Module Modules imports -Import the modules that you need in your App. Example: BrowserModule declarations Declare the components and directives that belong to your angular App. bootstrap -Declare the bootstrap component that your application. Every Angular app has a root module class. By convention, the root module class is called AppModule and it exists in a file named app.module.ts. @NgModule({ imports: [], declarations: [], bootstrap: [] }) export class AppModule{}
  • 39. Let’s Collect ’em all Bootstrap Your App
  • 40. Main Bootstrap Your App import { platformBrowserDynamic } from '@angular/platform- browser-dynamic'; import { AppModule } from './app.module'; platformBrowserDynamic().bootstrapModule(AppModule); main.ts
  • 42. If you have Syntax Error, Solve it yourself. You are able to do that.1 Mentors exist to guide you to the best way to solve the problem not to solve the problem or your syntax errors. 2 Steps of Solving the problem: - Think. - Think again. - Use Pen and Papers to convert your thoughts into Procedures. - Convert your previous pseudo code into JavaScript Code using its syntax rules. - Don’t be afraid of syntax errors. It is easy to solve. Read it clearly and you will solve it. - Check the output of every step you do and then check them all. 3 The most important rule is to enjoy challenging yourself and don’t stress your mind by the headache of assignments delivery’s deadlines. 4 Rules
  • 44. Windows Node & NPM Installation Website: https://www.nodejs.org Download the convenient Node version from the official website:1 Run the executable file downloaded and follow the instructions2 Check Node and npm version:3 $ node –v $ npm -v
  • 45. Linux Node & NPM Installation Run the following commands $ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - $ sudo apt-get install -y nodejs $ node –v $ npm –v
  • 46. Angular CLI Angular Installation Install Angular CLI $ npm install -g @angular/cli $ ng new os-app $ cd os-app $ ng serve Now App serve at localhost:4200
  • 47. LAB Beginner Movies DB App : Static Movie Example Moon Light Director: Barry Jenkins Writer: Tarell Alvin McCraney Actors: Mahershala Ali, Shariff Earp, Duan Sanderson 7.8
  • 48. LAB Intermediate Movies DB App : Edit person Example Moon Light Director: Barry Jenkins Writer: Tarell Alvin McCraney Actors: Mahershala Ali, Shariff Earp, Duan Sanderson 7.8 Name Nationality Rating 4.5 4.5 I’m Ahmed. I’m from Egypt
  • 49. LAB Advanced Movies DB App : Change Movie Example Name Nationality Rating 4.5 I’m Ahmed. I’m from Egypt 4.5 Manchester by Sea Director: Kenneth Lonergan Writer: Kenneth Lonergan Stars: Casey Affleck, Michelle Williams, Kyle Chandler 8
  • 50. Flash For the first one that who has completed the required assignments Captain America For the one who has the minimum syntax errors and his code is well organized Iron Man For the one who has the most generic and strong code Thor For the one who find the best and shortest way to solve the problems LAB Badges
  • 51. Thank You ahmedmowd@gmail.com To be continued … in the next level