SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...kalichargn70th171
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsDEEPRAJ PATHAK
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxRTS corp
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxSasikiranMarri
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
Key Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapKey Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapIshara Amarasekera
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 

Kürzlich hochgeladen (20)

The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
The Ultimate Guide to Performance Testing in Low-Code, No-Code Environments (...
 
Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software Projects
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptx
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
Key Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery RoadmapKey Steps in Agile Software Delivery Roadmap
Key Steps in Agile Software Delivery Roadmap
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 

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