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.
1. 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:
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. (Read in detail here)
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.
17. Angular uses typescript language, so try to implement typescript best practices for better angular outcome.
18. As angular applications are SPA’s (Single Page Application’s), it is not best for SEO(Search Engine Optimizations) by default.
19. Angular applications can be converted to great SEO sites using Angular Universal, ng-Toolkit etc.
20. Angular components can be generated using ng g c mycomponentname (or) ng g component mycomponentname through CLI’s.
650 total views, 2 views today