- Its a javascirpt framework
- Its different from angular js
- Used to build powerful frontend applications.
- Its used for rapid application development and code generation.
Some of important features of angular applications are :
- Lazy Loading
- Data binding
- HTTP Module
- Form Module (Template Driven and Reactive Form)
Ways to organize code :
To organize angular code we should use lazy loading, to get this we should create modules according to the features of application and we should create all sub components inside the module folder.
Benefits of feature module is it allows lazy loading so it load module when it require not on the time of app module load.
Single Responsibility Principle (SRP) :
- RULE OF ONE
- Define one component or service per file.
- Define small functions to reuse code.
- Use consistent names for all symbols.
- Use dashes to separate words in the descriptive names.
- Use consistent names for all assets named after what they represent.
- Use consistent names for all services named after their features.
LIFT Principle :
- Locate code fast
- Flat (Easy file structure)
- Try to Dry
Convention based approach :
- Structure our components in folders
- All services in service folder
Feature based approach :
- Each module has its own component, service and pipe files.
- All files inside the feature folder.
Some Useful ng Commands :
Component : ng generate component component_name
Service : ng generate service service_name
Pipe : ng generate pipe pipe_name
Directive : ng generate directive directive_name
Module : ng generate module module_name –route module_name –module app
Library ; ng generate library ng-shared (This will create the same folder like src folder)