100 Things to Know in Angular 4
I started writing this post with the intention to keep important and crispy factor about angular in one place. But I am not able to write all the 100 things about angular same time, so I am publishing the post with the information I have handy now and I will make sure this post get updated often till we reach 100 things, if possible 200 things 😉
If you guys have something to tell about angular 4, of course it’s very small and basic feel free to mention it in the comments section to help all angular developers and newbies.
Directives will not and should not have templates.
2. Directives will not have all the lifecycle hooks like components other ngOnInit and ngOnDestroy, because there is no view with directives.
3. *ngIf, *ngFor are structural directives.
Related Angular Article: Running First Angular-CLI Project in 2 Minutes
4. Structural directive is nothing but changing the template where as attribute directives [ngClass and ngStyle] just change the styling, but will not change the total template.
5. Directives are basically two types and that is structural and attribute directives.
6. Star(*) must be given to structural directives, as it has the ability to change the template of the page. Eg: *ngIf and *ngFor.
7. EventEmitter is used to output the values/references to parent component from child components. [Used with @Output].
8. @Input to listen the changes from parent component to child components.
9.  – syntax for property binding. Eg: [disabled]
10. () – syntax for event binding. Eg: (click), (text)
11. [(ngModule)] – syntax for two way databinding. Eg: [(ngModule)] = “username” [here two way databinding variable is username].
12. Angular has totally 8 lifecycle hooks.
13. Angular ngOnInit() and ngOnDestory() runs only once.
14. Components are also called as directives.
15. @Output to emit the changes from child component to parent components using Event Emitter.
16. Angular uses webpack module bundler to bundle the source codes and also helps to load the code chunks from server to browser.
525 total views, 1 views today