Added bootstrap 4 Added rxjs-compat
- generate component :
ng g c comp-name CREATE src/app/device/device.component.scss (0 bytes) CREATE src/app/device/device.component.html (21 bytes) CREATE src/app/device/device.component.ts (276 bytes) UPDATE src/app/app.module.ts (571 bytes)
- interpolation
-> send data from ts -> template
syntaxe : {{ }}
- Property binding
-> other way of dynamic linking from code to template.
syntaxe : []
ex : [disabled]="isAuth"
- Event binding Syntaxe : ()
ex : click on element from the DOM -> (click)=onTurnOn()
Good practice naming : onAction
- FormsModule
syntaxe : [()] ngModel
ex : from parent to children. @Input()
-> instructions
-> modify structure of document
syntaxe : tell Angular to take care of structural directives with the *
ex : *ngIf *ngFor
ex: ngModel
ngStyle ngClass
Provided by Angular data as input -> transform -> display
ex : date, uppercase, async
Can chain them.
centralize functionalities which can be used among the app. Need to inject a service (usually inside constructor) 3 levels of injections
Needs to be added within providers []
-> available everywhere !
-> available for all components but not other services
SPA (single page application) within main component
Order in route paths matters !!
ng g c auth ngg c device-view
routerLink instead of href
-> filter for our routes to set up on a service.
Rxjs/Rx for the methods
- use a Subscription object to control the observable.
- Apply another level of abstraction using a subject ex: device service
between observable & subscription
ex: map, filter, throttleTime (delay mini), scan, reduce
needs that : (ngSubmit)="onSubmit(f)"
And its local reference : #f="ngForm" refer the dom element from the DOM
And within inputs : add ngModel directive -> register this control onto angular
FormBuilder -> create FormGroup
ng g c auth/signup ng g c auth/signup ..
auth/ book-list/ ... services/ models/