Observables VS PromisesOBSERVABLESwork with multiple values over time cancellable support map, filter, reduce and similar operators use Reactive Extensions (RxJS) an array whose items arrive asynchronously over time emits a single value, . PROMISES return a single value not cancellable more readable code with try/catch and async/await PIPES| SERVICESPipes are a good way to format strings, currency amounts, dates and other display data. Services Services are a great way to share information among classes that don't know each other. |
RouterRouterOutlet is one of the router directives that became available to the AppComponent because AppModule imports AppRoutingModule which exported RouterModule. Add a navigation link (routerLink) /ABSOLUTEPATH RELATIVE PATH add a parameterized route (:) in the path indicates that :id is a placeholder for a specific hero id. HTTPHTTP data persistence features with help from Angular's HttpClient. The HeroService gets hero data with HTTP requests. Users can add, edit, and delete heroes and save these changes over HTTP. Users can search for heroes by name. communicating with a remote server over HTTP. |
BINDINGProperty binding –[] {{}} Event Binding –() For forms keypress use – (input)=method Two-way binding – [(holds comp value)] When ngModel is used.. import formModules in app.module After import add modules in import section Name and ngModel must be used tog @viewChildchange the behavior or appearance of an element in our template from our component class @ViewChild because we have only a single instance of it, but we have multiple todo items, so for them we need to apply the @ViewChildren decorator. |
DirectivesDirectives are for attribute. Giving power to element.. Structural – changes dom *ngIf. Else name.. renders only inside<ng-template #name(reference)> </ng-template> *ngFor | let i=index; let f=first; Unstructural [ngClass] = “{‘classname’: condition}” | methodname() [ngStyle]= “{‘prop value’: condition ? ‘value’ : ’value’}” Inside element use <ng-content> Local Reference -> get all info from html ele. #anyname to the ele. |
Cheatography
https://cheatography.com
Angular2 Cheat Sheet Cheat Sheet (DRAFT) by MonicaAngular
This is a draft cheat sheet. It is a work in progress and is not finished yet.