(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
MedTech
Dr. Lilia SFAXI
www.liliasfaxi.wix.com/liliasfaxi
Chp5- Angular
ES6 and TypeScript, Components, Dependency Injection…
1
MedTech – Mediterranean Institute of Technology
CS-Web and Mobile Development
MedTech
MedTech
Why Angular?
• Angular JS
• Javascript Framework for creating web and mobile single page applications
• Angular 2
• Easier to learn than Angular 1.x
• Fewer concepts
• Supports multiple languages (ES5, ES6, TypeScript and DART)
• Modular (everything is a Component)
• Performant (5X faster than version 1)
• This document explains the notions of Angular2, RC6 (February 2017)
2
Angular
MedTech
TYPESCRIPT
3
Angular
MedTech
Description
• Angular 2 is built in TypeScript
• Official collaboration between Microsoft and Google
• JavaScript-like language
• Superset of EcmaScript6
• Improvements over ES6
• Types
• Classes
• Annotations
• Imports
• Language Utilities (e.g. destructuring)
4
TypeScript
MedTech
Types
• Major improvement over ES6: type checking
• Helps when writing code because it prevents bugs at compile time
• Helps when reading code because it clarifies your intentions
• Typing is optional
• Same types as in ES: string, number, boolean,…
var name: string;
• Types can also be used in function declarations:
function greetText(name: string): string{
return "Hello " + name;
}
5
TypeScript
MedTech
Built-in Types
6
TypeScript
Types Examples
String var name : string = 'Lilia'
Number var age : number = 36
Boolean var married : boolean = true
Array var jobs : Array<string> = [‘IBM’, ‘Microsoft’,
‘Google’]
var jobs : string[] = [‘Apple’, ‘Dell’, ‘HP’]
Enums enum Role {Employee, Manager, Admin};
var role: Role = Role.Employee;
Role[0] //returns Employee
Any
(defaulttypeifomittingtyping
foragivenvariable)
var something: any = 'as string';
something = 1;
something = [1, 2, 3];
Void
(notypeexpected,noreturn
value)
function setName(name: string): void {
this.name = name;
}
MedTech
Classes
• In ES5, OO programming was accomplished by using prototype-based
objects
• In ES6, built-in classes were defined
class Vehicle {}
• Classes may have properties, methods and constructors
• Properties
• Each property can optionally have a type
7
TypeScript
class Person {
first_name: string;
last_name: string;
age: number;
}
MedTech
Classes
• Methods
• To call a method of a class, we have to create an instance of this class, with the
new keyword
• If the methods don’t declare an explicit return type and return a value, it’s
assumed to be any
8
TypeScript
class Person {
first_name: string;
last_name: string;
age: number;
greet(){
console.log("Hello ", this.first_name);
}
ageInYears(years: number): number {
return this.age + years;
}
}
MedTech
Classes
• Methods
• To invoke a method:
9
TypeScript
// declare a variable of type Person
var p: Person;
// instantiate a new Person instance
p = new Person();
// give it a first_name
p.first_name = 'Felipe';
// call the greet method
p.greet();
// how old will you be in 12 years?
p.ageInYears(12);
MedTech
Classes
• Constructor
• Named constructor(..)
• Doesn’t return any values
10
TypeScript
class Person {
first_name: string;
last_name: string;
age: number;
constructor(first:string,last:string,age:number){
this.first_name = first;
this.last_name = last;
this.age = age;
}
greet(){
console.log("Hello ", this.first_name);
}
}
var p: Person = new Person('Felipe', 'Coury', 36);
p.greet();
MedTech
Inheritance
• Inheritance is built in the core language
• Uses the extends keyword
• Let’s take a Report class:
11
TypeScript
class Report {
data: Array<string>;
constructor(data:Array<string>){
this.data = data;
}
run(){
this.data.forEach( function(line)
{ console.log(line); });}
}
var r: Report = new Report([‘First Line', ‘Second Line’]);
r.run();
MedTech
Inheritance
• We want to change how the report presents the data to the user:
12
TypeScript
class TabbedReport extends Report{
header: string;
constructor(header:string,values:string[]){
super(values);
this.header = header;
}
run(){
console.log('—'+header+'—');
super.run();
}
}
var header: string = 'Name';
var data: string[] =
['Alice Green', 'Paul Pfifer', 'Louis Blakenship'];
var r: TabbedReport = new TabbedReport(header, data)
MedTech
Fat Arrow Functions
• Fat arrow => functions are a shorthand notation for writing functions
13
TypeScript
// ES5-like example
var data =
['Alice Green', 'Paul Pfifer', 'Louis Blakenship'];
data.forEach(function(line) { console.log(line); });
// Typescript example
var data: string[] =
['Alice Green', 'Paul Pfifer', 'Louis Blakenship'];
data.forEach( (line) => console.log(line) );
MedTech
Fat Arrow Functions
• The => syntax shares the same this as the surrounding code
• Contrary to a normally created function in JavaScript
14
TypeScript
// ES5-like example
var nate = {
name: "Nate",
guitars:
["Gibson", "Martin", "Taylor"],
printGuitars: function() {
var self = this;
this.guitars.forEach(function(g)
{
console.log(self.name + "
plays a " + g);
});
}
};
// TypeScript example
var nate = {
name: "Nate",
guitars:
["Gibson", "Martin", "Taylor"],
printGuitars: function() {
this.guitars.forEach((g) => {
console.log(this.name + "
plays a " + g);
});
}
};
MedTech
Template Strings
• Introduced in ES6, enable:
• Variables within strings, without concatenation with +
• Multi-line strings
15
TypeScript
var firstName = "Nate";
var lastName = "Murray";
// interpolate a string
var greeting = `Hello ${ firstName} ${ lastName} `;
console.log(greeting);
var template = `
<div>
<h1> Hello</h1>
<p> This is a great website</p>
</div>
`
// do something with `template`
MedTech
TypeScript Language
• And there is more…
• Consult: http://www.typescriptlang.org/docs/tutorial.html for
more detailed information about the language!
16
TypeScript
MedTech
COMPONENTS IN ANGULAR
17
Angular
MedTech
Angular Application Structure
• An angular application is a tree of Components
• The top level component is the application itself, which is rendered by
the browser when bootstrapping the application.
• Components are:
• Composable
• Reusable
• Hierarchical
• Let's take as an example an inventory management application
18
Components in Angular
MedTech
Inventory App: Components
19
Components in Angular
Navigation
Component
Breadcrumbs
Component
ProductList
Component
MedTech
Inventory App: Components
20
Components in Angular
Product Row
Component
MedTech
Inventory App: Components
21
Components in Angular
Product Image
Component
Product Department
Component
Price Display
Component
MedTech
Inventory App: Tree Representation
22
Components in Angular
MedTech
Inventory App: Tree Representation
23
Components in Angular
MedTech
ANGULAR ARCHITECTURE
24
Angular
MedTech
Architecture
25
Angular Architecture
MedTech
Modules
• Angular apps are modular:
• An application defines a set of Angular Modules or NgModules
• Every angular module is a class with an @NgModule decorator
• Every Angular App has at least one module: the root module
• There are other feature modules
• Cohesive blocks of code, dedicated to an application domain, a workflow or a closely related
set of capabilities
• NgModule takes a single metadata object describing the module, with the following
properties
• Declarations: view classes (components, directives and piped)
• Exports: subset of public declarations, usable in the templates of other modules
• Imports: external modules needed by the templates of this module
• Providers: creators of services that this module contributes to
• Bootstrap: main application view, called the root component, that hosts all other app views
26
Angular Architecture
MedTech
Templates
• A snippet of the HTML code of a component
• A component's view is defined with its template
• Uses Angular's template syntax, with custom elements
27
Angular Architecture
<h2>Hero List</h2>
<p><i>Pick a hero from the list</i></p>
<ul>
<li *ngFor="let hero of heroes"
(click)="selectHero(hero)">
{{hero.name}}
</li>
</ul>
<hero-detail
*ngIf="selectedHero"
[hero]="selectedHero">
</hero-detail>
MedTech
Metadata
• Tells Angular how to process a class
• Uses decorators to attach information to a class:
• @Component: identifies the class below it as a component class, with
options:
• moduleId: source of the base address (module.id) for module-relative URLs (such as
templateURL)
• selector: CSS selector for the template code
• templateURL: address of the component's HTML template
• providers: array of dependency injection providers for services that the component requires
• Other metadata decorators:
• @Injectable, @Input, @Output,..
28
Angular Architecture
MedTech
Data Binding
• Angular supports Data Binding
• Mechanism for coordinating parts of a template with parts of a component
• Four main forms:
• {{hero.main}}: interpolation
• Displays the component's hero.name property value within the <li> element
• [hero]: property binding
• Passes the value of selectedHero to the child comp.
• (click): event binding
• Calls the component's selectHero method when the
user clicks a hero's name
• [(ngModel)]: Two-way data binding
• Combines property and event binding, with ngModel
29
Angular Architecture
<li>{{hero.name}}</li>
<hero-detail
[hero]="selectedHero">
</hero-detail>
<li (click)="selectHero(hero)">
</li>
<input [(ngModel)]="hero.name">
MedTech
Directives
• Angular templates are dynamic
• When Angular renders them, it transforms the DOM according to instructions
given by directives
• A directive is a class with the @Directive decorator
• A component is a directive-with-a-template
• A @Component decorator is actually a @Directive extended with template-
oriented features
• Appear within an element tag as attributes do
• Two types of directives
• Structural directives
• Attribute directives
30
Angular Architecture
MedTech
Directives
• Structural directives
• Alter the layout by adding, removing and replacing elements in the DOM
• Attribute directives
• Alter the appearance or behaviour of an existant element
• Look like regular HTML attributes
• Custom attributes
• You can write your own directives
31
Angular Architecture
<li *ngFor="let hero of heroes"></li>
<hero-detail *ngIf="selectedHero"></hero-detail>
<input [(ngModel)]="hero.name">
MedTech
Services
• Almost anything can be a service
• A class with a narrow, well-defined purpose
• Ex: logging servie, data service, tax calculator, application configuration,…
• There is no specific definition of a class in Angular, but classes are
fundamental to any Angular application
• Component classes should be lean
• They shouldn't fetch data from the server, validate user input or log directly to
the console
• They just deal with user experience, mediate between the view and the logic
• Everything non trivial should be delegated to services
• A service is associated to a component using dependency injection
32
Angular Architecture
MedTech
DEPENDENCY INJECTION
33
Angular
MedTech
Definition
• Important application design pattern
• Commonly called DI
• A way to supply a new instance of a class with the fully-formed
dependencies it requires
• Most dependencies are services
• DI is used to provide new components with the services they need
• It knows which services to instantiate by looking at the types of the
component's constructor parameters
• When Angular creates a component, it asks an injector for the services
it requires
34
Dependency Injection
constructor(private service: HeroService) { }
MedTech
Injector
• Maintains a container of service instances that it has previously
created
• If a requested service instance is not in the container, the injector
makes one and adds it to the container before returning the service to
Angular
• When all requested services have been resolved and returned, Angular
can call the component's constructor with those services as arguments
35
Dependency Injection
MedTech
Provider
• In order for the injector to know which services to instantiate, you need
to register a provider of each one of them
• Provider: Creates or returns a service
• It is registered in a module or a component
• Add it to the root module for it to be available everywhere
• Register it in the component to get a new instance of the service with each
new instance of the component
36
Dependency Injection
@NgModule({

imports: [

…
],
providers: [
HeroService,
Logger
],
…
})
@Component({
moduleId: module.id,
selector: 'hero-list',
templateUrl: './hero-list.component.html',
providers: [ HeroService ]
})
MedTech
@Injectable()
• @Injectable() marks a class as available to an injector for instantiation
• It is mandatory if the service class has an injected dependency
• For example: if the service needs another service, which is injected in it
• It is highly recommended to add an @Injectable() decorator for every
service class for the sake of
• Future proofing
• Consistency
• All components and directives are already subtypes of Injectable
• Even though they are instantiated by the injector, you don't have to add the
@Injectable() decorator to them
37
Dependency Injection
MedTech
ROUTING
38
Angular
MedTech
Angular Router
• Enables navigation from one view to the next as users perform
application tasks
• Interprets a browser URL as an instruction to navigate to a client-
generated view
• Can pass optional parameters to the supporting view component to help
it decide which specific content to display
• Logs activity in the browser's history journal so the back and forward
buttons work
• Most routing applications add a <base> element to the index.html as
the first child of <head>
• Tells the router how to compose navigation URLs
39
Routing
<base href="/">
MedTech
Angular Router
• One singleton instance of the
Router service exists for an
application
• When the browser's URL changes,
that router looks for the
corresponding Route to know
which component to display
• A router has no routes until you
configure it
• Using the
RouterModule.forRoot method
40
Routing
const appRoutes: Routes = [
{ path: 'crisis-center',
component: CrisisListComponent },
{ path: 'hero/:id',
component: HeroDetailComponent },
{ path: 'heroes',
component: HeroListComponent,
data: { title: 'Heroes List' }
},
{ path: '', redirectTo: '/heroes',
pathMatch: 'full'
},
{ path: '**',
component: PageNotFoundComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes)
// other imports here
],
...
})
export class AppModule { }
MedTech
Router Views
• In order to render the component chosen by the router, a RouterOutlet
is inserted in the template
• To navigate from a route to another, you use routerLinks
• routerLinkActive associates a CSS class "active" to the cliqued link
41
Routing
<router-outlet></router-outlet>
<!-- Routed views go here -->
template: `
<h1>Angular Router</h1>
<nav>
<a routerLink="/crisis-center"
routerLinkActive="active">Crisis Center</a>
<a routerLink="/heroes"
routerLinkActive="active">Heroes</a>
</nav>
<router-outlet></router-outlet>
`
MedTech
Routing Module
• For simple routing, defining the routes in the main application module
is fine
• It can become more difficult to manage if the application grows and you
use more Router features
• Refactor the routing configuration in its own file: the Routing Module
• The Routing Module
• Separates routing concerns from other application concerns
• Provides a module to replace or remove when testing the
application
• Provides a well-known location for routing service providers
• Does not declare components
42
Routing
MedTech
Routing Module: Example
43
Routing
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CrisisListComponent } from './crisis-list.component';
import { HeroListComponent } from './hero-list.component';
import { PageNotFoundComponent } from './not-found.component';
const appRoutes: Routes = [
{ path: 'crisis-center', component: CrisisListComponent },
{ path: 'heroes', component: HeroListComponent },
{ path: '', redirectTo: '/heroes', pathMatch: 'full' },
{ path: '**', component: PageNotFoundComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes)
],
exports: [
RouterModule
]
})
export class AppRoutingModule {}
MedTech
Navigation Guards
• Sometimes, routes need to be protected:
• to prevent users from accessing areas that they're not allowed to access
• to ask for permission, …
• Navigation Guards are applied to routes to do that
• Four guard types:
• CanActivate: decides if a route can be activated
• CanActivateChild: decides if child routes of a route can be activated
• CanDeactivate: decides if a route can be deactivated
• CanLoad: decides if a module can be loaded lazily
• Guards can be implemented in different ways, but mainly, you obtain a
function that returns Observable<boolean>, Promise<boolean> or
boolean
44
Routing
MedTech
Navigation Guards: as Functions
• To register a guard as a function, you need to define a token and the
guard function, represented as a provider
• Once the guard registered with a token, it is used on the route
configuration
45
Routing
@NgModule({
...
providers: [
provide: 'CanAlwaysActivateGuard',
useValue: () => {
return true;
}
],
...
})
export class AppModule {}
export const AppRoutes:RouterConfig = [
{
path: '',
component: SomeComponent,
canActivate:
['CanAlwaysActivateGuard']
}
];
MedTech
Navigation Guards: as Classes
• Sometimes, a guard needs DI capabilities
• Should be declared as Injectable classes
• Implement in this case CanActivate, CanDeactivate or CanActivateChild
interfaces
46
Routing
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { AuthService } from './auth.service';
@Injectable()
export class CanActivateViaAuthGuard
implements CanActivate {
constructor(private authService: AuthService){
}
canActivate() {
return this.authService.isLoggedIn();
}
@NgModule({
...
providers: [
AuthService,
CanActivateViaAuthGuard
]
})
export class AppModule {}
…
{
path: '',
component: SomeComponent,
canActivate: [
'CanAlwaysActivateGuard',
CanActivateViaAuthGuard
]
}
MedTech
Dr. Lilia SFAXI
www.liliasfaxi.wix.com/liliasfaxi
References
47
• Sites
• Angular2 official documentation, https://angular.io/docs, consulted in March
2017
• Pascal Precht, Protecting Routes Using Guards in Angular, https://
blog.thoughtram.io/angular/2016/07/18/guards-in-angular-2.html#as-
classes, updated in December 2016, consulted in March 2017
• Textbook
• Rangle’s Angular2 Training Book, rangle.io, Gitbook
• Ang-book 2, the complete book on AngularJS2, 2015-2016

More Related Content

What's hot

Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
Rohit Gupta
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
WebStackAcademy
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
Knoldus Inc.
 
Angular 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
Angular introduction students
Angular introduction studentsAngular introduction students
Angular introduction students
Christian John Felix
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
NAVEENSAGGAM1
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
Jennifer Estrada
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
Sam Dias
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
iFour Technolab Pvt. Ltd.
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
Rob Eisenberg
 
Angular Observables & RxJS Introduction
Angular Observables & RxJS IntroductionAngular Observables & RxJS Introduction
Angular Observables & RxJS Introduction
Rahat Khanna a.k.a mAppMechanic
 
Angular
AngularAngular
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
Coding Academy
 
AngularJS
AngularJS AngularJS
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
Mayank Panchal
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
Eyal Vardi
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
Simon Funk
 

What's hot (20)

Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
Angular 9
Angular 9 Angular 9
Angular 9
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
 
Angular 8
Angular 8 Angular 8
Angular 8
 
Angular introduction students
Angular introduction studentsAngular introduction students
Angular introduction students
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
Angular 10 course_content
Angular 10 course_contentAngular 10 course_content
Angular 10 course_content
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
Angular Observables & RxJS Introduction
Angular Observables & RxJS IntroductionAngular Observables & RxJS Introduction
Angular Observables & RxJS Introduction
 
Angular
AngularAngular
Angular
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
AngularJS
AngularJS AngularJS
AngularJS
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
 

Viewers also liked

Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
Lilia Sfaxi
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
Lilia Sfaxi
 
Core JavaScript
Core JavaScriptCore JavaScript
Core JavaScript
Lilia Sfaxi
 
Introduction au Web
Introduction au WebIntroduction au Web
Introduction au Web
Lilia Sfaxi
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
Lilia Sfaxi
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
Lilia Sfaxi
 
Mobile developement
Mobile developementMobile developement
Mobile developement
Lilia Sfaxi
 
BigData_TP2: Design Patterns dans Hadoop
BigData_TP2: Design Patterns dans HadoopBigData_TP2: Design Patterns dans Hadoop
BigData_TP2: Design Patterns dans Hadoop
Lilia Sfaxi
 
BigData_TP5 : Neo4J
BigData_TP5 : Neo4JBigData_TP5 : Neo4J
BigData_TP5 : Neo4J
Lilia Sfaxi
 
BigData_TP4 : Cassandra
BigData_TP4 : CassandraBigData_TP4 : Cassandra
BigData_TP4 : Cassandra
Lilia Sfaxi
 
BigData_TP1: Initiation à Hadoop et Map-Reduce
BigData_TP1: Initiation à Hadoop et Map-ReduceBigData_TP1: Initiation à Hadoop et Map-Reduce
BigData_TP1: Initiation à Hadoop et Map-Reduce
Lilia Sfaxi
 
BigData_TP3 : Spark
BigData_TP3 : SparkBigData_TP3 : Spark
BigData_TP3 : Spark
Lilia Sfaxi
 
BigData_Chp5: Putting it all together
BigData_Chp5: Putting it all togetherBigData_Chp5: Putting it all together
BigData_Chp5: Putting it all together
Lilia Sfaxi
 
BigData_Chp4: NOSQL
BigData_Chp4: NOSQLBigData_Chp4: NOSQL
BigData_Chp4: NOSQL
Lilia Sfaxi
 
BigData_Chp3: Data Processing
BigData_Chp3: Data ProcessingBigData_Chp3: Data Processing
BigData_Chp3: Data Processing
Lilia Sfaxi
 
BigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-ReduceBigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-Reduce
Lilia Sfaxi
 
BigData_Chp1: Introduction à la Big Data
BigData_Chp1: Introduction à la Big DataBigData_Chp1: Introduction à la Big Data
BigData_Chp1: Introduction à la Big Data
Lilia Sfaxi
 

Viewers also liked (17)

Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Core JavaScript
Core JavaScriptCore JavaScript
Core JavaScript
 
Introduction au Web
Introduction au WebIntroduction au Web
Introduction au Web
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
 
Mobile developement
Mobile developementMobile developement
Mobile developement
 
BigData_TP2: Design Patterns dans Hadoop
BigData_TP2: Design Patterns dans HadoopBigData_TP2: Design Patterns dans Hadoop
BigData_TP2: Design Patterns dans Hadoop
 
BigData_TP5 : Neo4J
BigData_TP5 : Neo4JBigData_TP5 : Neo4J
BigData_TP5 : Neo4J
 
BigData_TP4 : Cassandra
BigData_TP4 : CassandraBigData_TP4 : Cassandra
BigData_TP4 : Cassandra
 
BigData_TP1: Initiation à Hadoop et Map-Reduce
BigData_TP1: Initiation à Hadoop et Map-ReduceBigData_TP1: Initiation à Hadoop et Map-Reduce
BigData_TP1: Initiation à Hadoop et Map-Reduce
 
BigData_TP3 : Spark
BigData_TP3 : SparkBigData_TP3 : Spark
BigData_TP3 : Spark
 
BigData_Chp5: Putting it all together
BigData_Chp5: Putting it all togetherBigData_Chp5: Putting it all together
BigData_Chp5: Putting it all together
 
BigData_Chp4: NOSQL
BigData_Chp4: NOSQLBigData_Chp4: NOSQL
BigData_Chp4: NOSQL
 
BigData_Chp3: Data Processing
BigData_Chp3: Data ProcessingBigData_Chp3: Data Processing
BigData_Chp3: Data Processing
 
BigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-ReduceBigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-Reduce
 
BigData_Chp1: Introduction à la Big Data
BigData_Chp1: Introduction à la Big DataBigData_Chp1: Introduction à la Big Data
BigData_Chp1: Introduction à la Big Data
 

Similar to Angular

MDE in Practice
MDE in PracticeMDE in Practice
MDE in Practice
Abdalmassih Yakeen
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
Alessandro Giorgetti
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
Corley S.r.l.
 
Utilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learningUtilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learning
Paris Data Engineers !
 
Eclipse 40 - Eclipse Summit Europe 2010
Eclipse 40 - Eclipse Summit Europe 2010Eclipse 40 - Eclipse Summit Europe 2010
Eclipse 40 - Eclipse Summit Europe 2010
Lars Vogel
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
Neo4j
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScript
Ahmed El-Kady
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScript
Gil Fink
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
Rohit Bishnoi
 
better-apps-angular-2-day1.pdf and home
better-apps-angular-2-day1.pdf  and homebetter-apps-angular-2-day1.pdf  and home
better-apps-angular-2-day1.pdf and home
ChethanGowda886434
 
Angular2
Angular2Angular2
Kelis king - introduction to software design
Kelis king -  introduction to software designKelis king -  introduction to software design
Kelis king - introduction to software design
KelisKing
 
React inter3
React inter3React inter3
React inter3
Oswald Campesato
 
Angular js for Beginnners
Angular js for BeginnnersAngular js for Beginnners
Angular js for Beginnners
Santosh Kumar Kar
 
Dynamics AX 7 Development - IDE (Part I)
Dynamics AX 7 Development - IDE (Part I)Dynamics AX 7 Development - IDE (Part I)
Dynamics AX 7 Development - IDE (Part I)
Bohdan Bilous
 
#CNX14 - Intro to Force
#CNX14 - Intro to Force#CNX14 - Intro to Force
#CNX14 - Intro to Force
Salesforce Marketing Cloud
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
iOS Beginners Lesson 1
iOS Beginners Lesson 1iOS Beginners Lesson 1
iOS Beginners Lesson 1
Calvin Cheng
 
Tango with django
Tango with djangoTango with django
Tango with django
Rajan Kumar Upadhyay
 
Handlebars and Require.js
Handlebars and Require.jsHandlebars and Require.js
Handlebars and Require.js
Ivano Malavolta
 

Similar to Angular (20)

MDE in Practice
MDE in PracticeMDE in Practice
MDE in Practice
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
 
Utilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learningUtilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learning
 
Eclipse 40 - Eclipse Summit Europe 2010
Eclipse 40 - Eclipse Summit Europe 2010Eclipse 40 - Eclipse Summit Europe 2010
Eclipse 40 - Eclipse Summit Europe 2010
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScript
 
End-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScriptEnd-to-End SPA Development using TypeScript
End-to-End SPA Development using TypeScript
 
Angular2 with TypeScript
Angular2 with TypeScript Angular2 with TypeScript
Angular2 with TypeScript
 
better-apps-angular-2-day1.pdf and home
better-apps-angular-2-day1.pdf  and homebetter-apps-angular-2-day1.pdf  and home
better-apps-angular-2-day1.pdf and home
 
Angular2
Angular2Angular2
Angular2
 
Kelis king - introduction to software design
Kelis king -  introduction to software designKelis king -  introduction to software design
Kelis king - introduction to software design
 
React inter3
React inter3React inter3
React inter3
 
Angular js for Beginnners
Angular js for BeginnnersAngular js for Beginnners
Angular js for Beginnners
 
Dynamics AX 7 Development - IDE (Part I)
Dynamics AX 7 Development - IDE (Part I)Dynamics AX 7 Development - IDE (Part I)
Dynamics AX 7 Development - IDE (Part I)
 
#CNX14 - Intro to Force
#CNX14 - Intro to Force#CNX14 - Intro to Force
#CNX14 - Intro to Force
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
 
iOS Beginners Lesson 1
iOS Beginners Lesson 1iOS Beginners Lesson 1
iOS Beginners Lesson 1
 
Tango with django
Tango with djangoTango with django
Tango with django
 
Handlebars and Require.js
Handlebars and Require.jsHandlebars and Require.js
Handlebars and Require.js
 

More from Lilia Sfaxi

chp1-Intro à l'urbanisation des SI.pdf
chp1-Intro à l'urbanisation des SI.pdfchp1-Intro à l'urbanisation des SI.pdf
chp1-Intro à l'urbanisation des SI.pdf
Lilia Sfaxi
 
Plan d'études_INSAT_2022_2023.pdf
Plan d'études_INSAT_2022_2023.pdfPlan d'études_INSAT_2022_2023.pdf
Plan d'études_INSAT_2022_2023.pdf
Lilia Sfaxi
 
Lab3-DB_Neo4j
Lab3-DB_Neo4jLab3-DB_Neo4j
Lab3-DB_Neo4j
Lilia Sfaxi
 
Lab2-DB-Mongodb
Lab2-DB-MongodbLab2-DB-Mongodb
Lab2-DB-Mongodb
Lilia Sfaxi
 
Lab1-DB-Cassandra
Lab1-DB-CassandraLab1-DB-Cassandra
Lab1-DB-Cassandra
Lilia Sfaxi
 
TP2-UML-Correction
TP2-UML-CorrectionTP2-UML-Correction
TP2-UML-Correction
Lilia Sfaxi
 
TP1-UML-Correction
TP1-UML-CorrectionTP1-UML-Correction
TP1-UML-Correction
Lilia Sfaxi
 
TP0-UML-Correction
TP0-UML-CorrectionTP0-UML-Correction
TP0-UML-Correction
Lilia Sfaxi
 
TD4-UML
TD4-UMLTD4-UML
TD4-UML
Lilia Sfaxi
 
TD4-UML-Correction
TD4-UML-CorrectionTD4-UML-Correction
TD4-UML-Correction
Lilia Sfaxi
 
TD3-UML-Séquences
TD3-UML-SéquencesTD3-UML-Séquences
TD3-UML-Séquences
Lilia Sfaxi
 
TD3-UML-Correction
TD3-UML-CorrectionTD3-UML-Correction
TD3-UML-Correction
Lilia Sfaxi
 
TD2 - UML - Correction
TD2 - UML - CorrectionTD2 - UML - Correction
TD2 - UML - Correction
Lilia Sfaxi
 
TD1 - UML - DCU
TD1 - UML - DCUTD1 - UML - DCU
TD1 - UML - DCU
Lilia Sfaxi
 
TD1-UML-correction
TD1-UML-correctionTD1-UML-correction
TD1-UML-correction
Lilia Sfaxi
 
Android - Tp1 - installation et démarrage
Android - Tp1 -   installation et démarrageAndroid - Tp1 -   installation et démarrage
Android - Tp1 - installation et démarrage
Lilia Sfaxi
 
Android - Tp2 - Elements graphiques
Android - Tp2 - Elements graphiques Android - Tp2 - Elements graphiques
Android - Tp2 - Elements graphiques
Lilia Sfaxi
 
Android - Tp3 - intents
Android - Tp3 -  intentsAndroid - Tp3 -  intents
Android - Tp3 - intents
Lilia Sfaxi
 
Android - TPBonus - web services
Android - TPBonus - web servicesAndroid - TPBonus - web services
Android - TPBonus - web services
Lilia Sfaxi
 
Android - Tp4 - graphiques avancés
Android - Tp4 - graphiques avancésAndroid - Tp4 - graphiques avancés
Android - Tp4 - graphiques avancés
Lilia Sfaxi
 

More from Lilia Sfaxi (20)

chp1-Intro à l'urbanisation des SI.pdf
chp1-Intro à l'urbanisation des SI.pdfchp1-Intro à l'urbanisation des SI.pdf
chp1-Intro à l'urbanisation des SI.pdf
 
Plan d'études_INSAT_2022_2023.pdf
Plan d'études_INSAT_2022_2023.pdfPlan d'études_INSAT_2022_2023.pdf
Plan d'études_INSAT_2022_2023.pdf
 
Lab3-DB_Neo4j
Lab3-DB_Neo4jLab3-DB_Neo4j
Lab3-DB_Neo4j
 
Lab2-DB-Mongodb
Lab2-DB-MongodbLab2-DB-Mongodb
Lab2-DB-Mongodb
 
Lab1-DB-Cassandra
Lab1-DB-CassandraLab1-DB-Cassandra
Lab1-DB-Cassandra
 
TP2-UML-Correction
TP2-UML-CorrectionTP2-UML-Correction
TP2-UML-Correction
 
TP1-UML-Correction
TP1-UML-CorrectionTP1-UML-Correction
TP1-UML-Correction
 
TP0-UML-Correction
TP0-UML-CorrectionTP0-UML-Correction
TP0-UML-Correction
 
TD4-UML
TD4-UMLTD4-UML
TD4-UML
 
TD4-UML-Correction
TD4-UML-CorrectionTD4-UML-Correction
TD4-UML-Correction
 
TD3-UML-Séquences
TD3-UML-SéquencesTD3-UML-Séquences
TD3-UML-Séquences
 
TD3-UML-Correction
TD3-UML-CorrectionTD3-UML-Correction
TD3-UML-Correction
 
TD2 - UML - Correction
TD2 - UML - CorrectionTD2 - UML - Correction
TD2 - UML - Correction
 
TD1 - UML - DCU
TD1 - UML - DCUTD1 - UML - DCU
TD1 - UML - DCU
 
TD1-UML-correction
TD1-UML-correctionTD1-UML-correction
TD1-UML-correction
 
Android - Tp1 - installation et démarrage
Android - Tp1 -   installation et démarrageAndroid - Tp1 -   installation et démarrage
Android - Tp1 - installation et démarrage
 
Android - Tp2 - Elements graphiques
Android - Tp2 - Elements graphiques Android - Tp2 - Elements graphiques
Android - Tp2 - Elements graphiques
 
Android - Tp3 - intents
Android - Tp3 -  intentsAndroid - Tp3 -  intents
Android - Tp3 - intents
 
Android - TPBonus - web services
Android - TPBonus - web servicesAndroid - TPBonus - web services
Android - TPBonus - web services
 
Android - Tp4 - graphiques avancés
Android - Tp4 - graphiques avancésAndroid - Tp4 - graphiques avancés
Android - Tp4 - graphiques avancés
 

Recently uploaded

The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
apoorva2579
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
The Digital Insurer
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
Alpen-Adria-Universität
 
What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)
Margaret Fero
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
Eric D. Schabell
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
Safe Software
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
Data Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber SecurityData Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber Security
anupriti
 
Running a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU ImpactsRunning a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU Impacts
ScyllaDB
 
Hire a private investigator to get cell phone records
Hire a private investigator to get cell phone recordsHire a private investigator to get cell phone records
Hire a private investigator to get cell phone records
HackersList
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
Edge AI and Vision Alliance
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
AI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AIAI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AI
Raphaël Semeteys
 

Recently uploaded (20)

The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
 
What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
Data Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber SecurityData Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber Security
 
Running a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU ImpactsRunning a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU Impacts
 
Hire a private investigator to get cell phone records
Hire a private investigator to get cell phone recordsHire a private investigator to get cell phone records
Hire a private investigator to get cell phone records
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
AI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AIAI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AI
 

Angular

  • 1. MedTech Dr. Lilia SFAXI www.liliasfaxi.wix.com/liliasfaxi Chp5- Angular ES6 and TypeScript, Components, Dependency Injection… 1 MedTech – Mediterranean Institute of Technology CS-Web and Mobile Development MedTech
  • 2. MedTech Why Angular? • Angular JS • Javascript Framework for creating web and mobile single page applications • Angular 2 • Easier to learn than Angular 1.x • Fewer concepts • Supports multiple languages (ES5, ES6, TypeScript and DART) • Modular (everything is a Component) • Performant (5X faster than version 1) • This document explains the notions of Angular2, RC6 (February 2017) 2 Angular
  • 4. MedTech Description • Angular 2 is built in TypeScript • Official collaboration between Microsoft and Google • JavaScript-like language • Superset of EcmaScript6 • Improvements over ES6 • Types • Classes • Annotations • Imports • Language Utilities (e.g. destructuring) 4 TypeScript
  • 5. MedTech Types • Major improvement over ES6: type checking • Helps when writing code because it prevents bugs at compile time • Helps when reading code because it clarifies your intentions • Typing is optional • Same types as in ES: string, number, boolean,… var name: string; • Types can also be used in function declarations: function greetText(name: string): string{ return "Hello " + name; } 5 TypeScript
  • 6. MedTech Built-in Types 6 TypeScript Types Examples String var name : string = 'Lilia' Number var age : number = 36 Boolean var married : boolean = true Array var jobs : Array<string> = [‘IBM’, ‘Microsoft’, ‘Google’] var jobs : string[] = [‘Apple’, ‘Dell’, ‘HP’] Enums enum Role {Employee, Manager, Admin}; var role: Role = Role.Employee; Role[0] //returns Employee Any (defaulttypeifomittingtyping foragivenvariable) var something: any = 'as string'; something = 1; something = [1, 2, 3]; Void (notypeexpected,noreturn value) function setName(name: string): void { this.name = name; }
  • 7. MedTech Classes • In ES5, OO programming was accomplished by using prototype-based objects • In ES6, built-in classes were defined class Vehicle {} • Classes may have properties, methods and constructors • Properties • Each property can optionally have a type 7 TypeScript class Person { first_name: string; last_name: string; age: number; }
  • 8. MedTech Classes • Methods • To call a method of a class, we have to create an instance of this class, with the new keyword • If the methods don’t declare an explicit return type and return a value, it’s assumed to be any 8 TypeScript class Person { first_name: string; last_name: string; age: number; greet(){ console.log("Hello ", this.first_name); } ageInYears(years: number): number { return this.age + years; } }
  • 9. MedTech Classes • Methods • To invoke a method: 9 TypeScript // declare a variable of type Person var p: Person; // instantiate a new Person instance p = new Person(); // give it a first_name p.first_name = 'Felipe'; // call the greet method p.greet(); // how old will you be in 12 years? p.ageInYears(12);
  • 10. MedTech Classes • Constructor • Named constructor(..) • Doesn’t return any values 10 TypeScript class Person { first_name: string; last_name: string; age: number; constructor(first:string,last:string,age:number){ this.first_name = first; this.last_name = last; this.age = age; } greet(){ console.log("Hello ", this.first_name); } } var p: Person = new Person('Felipe', 'Coury', 36); p.greet();
  • 11. MedTech Inheritance • Inheritance is built in the core language • Uses the extends keyword • Let’s take a Report class: 11 TypeScript class Report { data: Array<string>; constructor(data:Array<string>){ this.data = data; } run(){ this.data.forEach( function(line) { console.log(line); });} } var r: Report = new Report([‘First Line', ‘Second Line’]); r.run();
  • 12. MedTech Inheritance • We want to change how the report presents the data to the user: 12 TypeScript class TabbedReport extends Report{ header: string; constructor(header:string,values:string[]){ super(values); this.header = header; } run(){ console.log('—'+header+'—'); super.run(); } } var header: string = 'Name'; var data: string[] = ['Alice Green', 'Paul Pfifer', 'Louis Blakenship']; var r: TabbedReport = new TabbedReport(header, data)
  • 13. MedTech Fat Arrow Functions • Fat arrow => functions are a shorthand notation for writing functions 13 TypeScript // ES5-like example var data = ['Alice Green', 'Paul Pfifer', 'Louis Blakenship']; data.forEach(function(line) { console.log(line); }); // Typescript example var data: string[] = ['Alice Green', 'Paul Pfifer', 'Louis Blakenship']; data.forEach( (line) => console.log(line) );
  • 14. MedTech Fat Arrow Functions • The => syntax shares the same this as the surrounding code • Contrary to a normally created function in JavaScript 14 TypeScript // ES5-like example var nate = { name: "Nate", guitars: ["Gibson", "Martin", "Taylor"], printGuitars: function() { var self = this; this.guitars.forEach(function(g) { console.log(self.name + " plays a " + g); }); } }; // TypeScript example var nate = { name: "Nate", guitars: ["Gibson", "Martin", "Taylor"], printGuitars: function() { this.guitars.forEach((g) => { console.log(this.name + " plays a " + g); }); } };
  • 15. MedTech Template Strings • Introduced in ES6, enable: • Variables within strings, without concatenation with + • Multi-line strings 15 TypeScript var firstName = "Nate"; var lastName = "Murray"; // interpolate a string var greeting = `Hello ${ firstName} ${ lastName} `; console.log(greeting); var template = ` <div> <h1> Hello</h1> <p> This is a great website</p> </div> ` // do something with `template`
  • 16. MedTech TypeScript Language • And there is more… • Consult: http://www.typescriptlang.org/docs/tutorial.html for more detailed information about the language! 16 TypeScript
  • 18. MedTech Angular Application Structure • An angular application is a tree of Components • The top level component is the application itself, which is rendered by the browser when bootstrapping the application. • Components are: • Composable • Reusable • Hierarchical • Let's take as an example an inventory management application 18 Components in Angular
  • 19. MedTech Inventory App: Components 19 Components in Angular Navigation Component Breadcrumbs Component ProductList Component
  • 20. MedTech Inventory App: Components 20 Components in Angular Product Row Component
  • 21. MedTech Inventory App: Components 21 Components in Angular Product Image Component Product Department Component Price Display Component
  • 22. MedTech Inventory App: Tree Representation 22 Components in Angular
  • 23. MedTech Inventory App: Tree Representation 23 Components in Angular
  • 26. MedTech Modules • Angular apps are modular: • An application defines a set of Angular Modules or NgModules • Every angular module is a class with an @NgModule decorator • Every Angular App has at least one module: the root module • There are other feature modules • Cohesive blocks of code, dedicated to an application domain, a workflow or a closely related set of capabilities • NgModule takes a single metadata object describing the module, with the following properties • Declarations: view classes (components, directives and piped) • Exports: subset of public declarations, usable in the templates of other modules • Imports: external modules needed by the templates of this module • Providers: creators of services that this module contributes to • Bootstrap: main application view, called the root component, that hosts all other app views 26 Angular Architecture
  • 27. MedTech Templates • A snippet of the HTML code of a component • A component's view is defined with its template • Uses Angular's template syntax, with custom elements 27 Angular Architecture <h2>Hero List</h2> <p><i>Pick a hero from the list</i></p> <ul> <li *ngFor="let hero of heroes" (click)="selectHero(hero)"> {{hero.name}} </li> </ul> <hero-detail *ngIf="selectedHero" [hero]="selectedHero"> </hero-detail>
  • 28. MedTech Metadata • Tells Angular how to process a class • Uses decorators to attach information to a class: • @Component: identifies the class below it as a component class, with options: • moduleId: source of the base address (module.id) for module-relative URLs (such as templateURL) • selector: CSS selector for the template code • templateURL: address of the component's HTML template • providers: array of dependency injection providers for services that the component requires • Other metadata decorators: • @Injectable, @Input, @Output,.. 28 Angular Architecture
  • 29. MedTech Data Binding • Angular supports Data Binding • Mechanism for coordinating parts of a template with parts of a component • Four main forms: • {{hero.main}}: interpolation • Displays the component's hero.name property value within the <li> element • [hero]: property binding • Passes the value of selectedHero to the child comp. • (click): event binding • Calls the component's selectHero method when the user clicks a hero's name • [(ngModel)]: Two-way data binding • Combines property and event binding, with ngModel 29 Angular Architecture <li>{{hero.name}}</li> <hero-detail [hero]="selectedHero"> </hero-detail> <li (click)="selectHero(hero)"> </li> <input [(ngModel)]="hero.name">
  • 30. MedTech Directives • Angular templates are dynamic • When Angular renders them, it transforms the DOM according to instructions given by directives • A directive is a class with the @Directive decorator • A component is a directive-with-a-template • A @Component decorator is actually a @Directive extended with template- oriented features • Appear within an element tag as attributes do • Two types of directives • Structural directives • Attribute directives 30 Angular Architecture
  • 31. MedTech Directives • Structural directives • Alter the layout by adding, removing and replacing elements in the DOM • Attribute directives • Alter the appearance or behaviour of an existant element • Look like regular HTML attributes • Custom attributes • You can write your own directives 31 Angular Architecture <li *ngFor="let hero of heroes"></li> <hero-detail *ngIf="selectedHero"></hero-detail> <input [(ngModel)]="hero.name">
  • 32. MedTech Services • Almost anything can be a service • A class with a narrow, well-defined purpose • Ex: logging servie, data service, tax calculator, application configuration,… • There is no specific definition of a class in Angular, but classes are fundamental to any Angular application • Component classes should be lean • They shouldn't fetch data from the server, validate user input or log directly to the console • They just deal with user experience, mediate between the view and the logic • Everything non trivial should be delegated to services • A service is associated to a component using dependency injection 32 Angular Architecture
  • 34. MedTech Definition • Important application design pattern • Commonly called DI • A way to supply a new instance of a class with the fully-formed dependencies it requires • Most dependencies are services • DI is used to provide new components with the services they need • It knows which services to instantiate by looking at the types of the component's constructor parameters • When Angular creates a component, it asks an injector for the services it requires 34 Dependency Injection constructor(private service: HeroService) { }
  • 35. MedTech Injector • Maintains a container of service instances that it has previously created • If a requested service instance is not in the container, the injector makes one and adds it to the container before returning the service to Angular • When all requested services have been resolved and returned, Angular can call the component's constructor with those services as arguments 35 Dependency Injection
  • 36. MedTech Provider • In order for the injector to know which services to instantiate, you need to register a provider of each one of them • Provider: Creates or returns a service • It is registered in a module or a component • Add it to the root module for it to be available everywhere • Register it in the component to get a new instance of the service with each new instance of the component 36 Dependency Injection @NgModule({
 imports: [
 … ], providers: [ HeroService, Logger ], … }) @Component({ moduleId: module.id, selector: 'hero-list', templateUrl: './hero-list.component.html', providers: [ HeroService ] })
  • 37. MedTech @Injectable() • @Injectable() marks a class as available to an injector for instantiation • It is mandatory if the service class has an injected dependency • For example: if the service needs another service, which is injected in it • It is highly recommended to add an @Injectable() decorator for every service class for the sake of • Future proofing • Consistency • All components and directives are already subtypes of Injectable • Even though they are instantiated by the injector, you don't have to add the @Injectable() decorator to them 37 Dependency Injection
  • 39. MedTech Angular Router • Enables navigation from one view to the next as users perform application tasks • Interprets a browser URL as an instruction to navigate to a client- generated view • Can pass optional parameters to the supporting view component to help it decide which specific content to display • Logs activity in the browser's history journal so the back and forward buttons work • Most routing applications add a <base> element to the index.html as the first child of <head> • Tells the router how to compose navigation URLs 39 Routing <base href="/">
  • 40. MedTech Angular Router • One singleton instance of the Router service exists for an application • When the browser's URL changes, that router looks for the corresponding Route to know which component to display • A router has no routes until you configure it • Using the RouterModule.forRoot method 40 Routing const appRoutes: Routes = [ { path: 'crisis-center', component: CrisisListComponent }, { path: 'hero/:id', component: HeroDetailComponent }, { path: 'heroes', component: HeroListComponent, data: { title: 'Heroes List' } }, { path: '', redirectTo: '/heroes', pathMatch: 'full' }, { path: '**', component: PageNotFoundComponent } ]; @NgModule({ imports: [ RouterModule.forRoot(appRoutes) // other imports here ], ... }) export class AppModule { }
  • 41. MedTech Router Views • In order to render the component chosen by the router, a RouterOutlet is inserted in the template • To navigate from a route to another, you use routerLinks • routerLinkActive associates a CSS class "active" to the cliqued link 41 Routing <router-outlet></router-outlet> <!-- Routed views go here --> template: ` <h1>Angular Router</h1> <nav> <a routerLink="/crisis-center" routerLinkActive="active">Crisis Center</a> <a routerLink="/heroes" routerLinkActive="active">Heroes</a> </nav> <router-outlet></router-outlet> `
  • 42. MedTech Routing Module • For simple routing, defining the routes in the main application module is fine • It can become more difficult to manage if the application grows and you use more Router features • Refactor the routing configuration in its own file: the Routing Module • The Routing Module • Separates routing concerns from other application concerns • Provides a module to replace or remove when testing the application • Provides a well-known location for routing service providers • Does not declare components 42 Routing
  • 43. MedTech Routing Module: Example 43 Routing import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CrisisListComponent } from './crisis-list.component'; import { HeroListComponent } from './hero-list.component'; import { PageNotFoundComponent } from './not-found.component'; const appRoutes: Routes = [ { path: 'crisis-center', component: CrisisListComponent }, { path: 'heroes', component: HeroListComponent }, { path: '', redirectTo: '/heroes', pathMatch: 'full' }, { path: '**', component: PageNotFoundComponent } ]; @NgModule({ imports: [ RouterModule.forRoot(appRoutes) ], exports: [ RouterModule ] }) export class AppRoutingModule {}
  • 44. MedTech Navigation Guards • Sometimes, routes need to be protected: • to prevent users from accessing areas that they're not allowed to access • to ask for permission, … • Navigation Guards are applied to routes to do that • Four guard types: • CanActivate: decides if a route can be activated • CanActivateChild: decides if child routes of a route can be activated • CanDeactivate: decides if a route can be deactivated • CanLoad: decides if a module can be loaded lazily • Guards can be implemented in different ways, but mainly, you obtain a function that returns Observable<boolean>, Promise<boolean> or boolean 44 Routing
  • 45. MedTech Navigation Guards: as Functions • To register a guard as a function, you need to define a token and the guard function, represented as a provider • Once the guard registered with a token, it is used on the route configuration 45 Routing @NgModule({ ... providers: [ provide: 'CanAlwaysActivateGuard', useValue: () => { return true; } ], ... }) export class AppModule {} export const AppRoutes:RouterConfig = [ { path: '', component: SomeComponent, canActivate: ['CanAlwaysActivateGuard'] } ];
  • 46. MedTech Navigation Guards: as Classes • Sometimes, a guard needs DI capabilities • Should be declared as Injectable classes • Implement in this case CanActivate, CanDeactivate or CanActivateChild interfaces 46 Routing import { Injectable } from '@angular/core'; import { CanActivate } from '@angular/router'; import { AuthService } from './auth.service'; @Injectable() export class CanActivateViaAuthGuard implements CanActivate { constructor(private authService: AuthService){ } canActivate() { return this.authService.isLoggedIn(); } @NgModule({ ... providers: [ AuthService, CanActivateViaAuthGuard ] }) export class AppModule {} … { path: '', component: SomeComponent, canActivate: [ 'CanAlwaysActivateGuard', CanActivateViaAuthGuard ] }
  • 47. MedTech Dr. Lilia SFAXI www.liliasfaxi.wix.com/liliasfaxi References 47 • Sites • Angular2 official documentation, https://angular.io/docs, consulted in March 2017 • Pascal Precht, Protecting Routes Using Guards in Angular, https:// blog.thoughtram.io/angular/2016/07/18/guards-in-angular-2.html#as- classes, updated in December 2016, consulted in March 2017 • Textbook • Rangle’s Angular2 Training Book, rangle.io, Gitbook • Ang-book 2, the complete book on AngularJS2, 2015-2016