Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Angular Cheat Sheet: One framework for Mobile & Desktop, Cheat Sheet of Applications of Computer Sciences

Cheat Sheet on AngularJS, a JavaScript-based open-source front-end web framework

Typology: Cheat Sheet

2019/2020

Uploaded on 10/09/2020

torley
torley 🇺🇸

4.6

(41)

258 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ANGULAR CHEAT SHEET
One framework. Mobile & desktop.
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 {}
Parameter Function
declarations Components to this module
imports Modules to import into this
module
exports Components visible to another
module
providers Dependency injection providers
bootstrap The root component of module
The pipes and directive is declared as components
BOOTSTRAPPING
NGMODULE
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
CLASS TYPE
pf2

Partial preview of the text

Download Angular Cheat Sheet: One framework for Mobile & Desktop and more Cheat Sheet Applications of Computer Sciences in PDF only on Docsity!

ANGULAR CHEAT SHEET

One framework. Mobile & desktop.

groupe-sii.github.io/cheat-sheets www.groupe-sii.com blog.groupe-sii.com

Bootstraps the app, using the root component from the

specied NgModule.

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

platformBrowserDynamic() .bootstrapModule(AppModule);

Denes 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 {}

Parameter Function

declarations Components to this module

imports

Modules to import into this

module

exports

Components visible to another

module

providers Dependency injection providers

bootstrap The root component of module

The pipes and directive is declared as components

BOOTSTRAPPING

NGMODULE

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

CLASS TYPE

ANGULAR CHEAT SHEET

groupe-sii.github.io/cheat-sheets www.groupe-sii.com blog.groupe-sii.com

Data direction Syntax

DataSource =>

Target

{{expression}}

DataSource =>

Target

[target]="expression"

DataSource =>

Target

bind-target="expression"

Target =>

DataSource

(target)="statement"

Target =>

DataSource

on-target="statement"

Two-way [(target)]="expression"

Two-way

bindon-

target="expression"

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

**

TEMPLATE SYNTAX

Angular module: http://www.learn-angular.fr/les- modules-angular/

Template syntax: https://angular.io/guide/template- syntax

OBSERVABLE

SOURCES