

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


groupe-sii.github.io/cheat-sheets www.groupe-sii.com blog.groupe-sii.com
Bootstraps the app, using the root component from the
speci ed NgModule.
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
platformBrowserDynamic() .bootstrapModule(AppModule);
De nes a module that contains components,
directives, pipes, and providers.
import { NgModule } from '@angular/core';
@NgModule({ declarations: [ myRootComponent, myComponent, myDirective, myPipe], imports: [myModule, npmModule], exports: [myComponent], providers: [myService], bootstrap: [myRootComponent]// Only root module }) class MyModule {}
The pipes and directive is declared as components
Component
@Component({ selector: 'app-my', templateUrl: './my.component.html', styleUrls: ['./my.component.css'] }) class MyComponent() {}
Directive
@Directive({ selector: 'app-my', templateUrl: './my.directive.html', styleUrls: ['./my.directive.css'] }) class MyDirective() {}
Pipe
@Pipe({name: 'myPipe'}) class MyPipe() {}
Provider
@Injectable() class MyService() {}
Add{providedIn: root} option for create singleton
groupe-sii.github.io/cheat-sheets www.groupe-sii.com blog.groupe-sii.com
ngIf
*<span ngIf="hero">{{ hero.name }} exists !
ngFor
*<span ngFor="let hero of heroes; let i=index">{{ hero.name }} is at index {{ i }}
ngSwitch
**<div [ngSwitch]="hero.class"> <span *ngSwitchCase="'knight'">You are strong <span *ngSwitchCase="'mage'">You are intelligent <span *ngSwitchDefault>You are special
Angular module: http://www.learn-angular.fr/les- modules-angular/
Template syntax: https://angular.io/guide/template- syntax