angularjsangularangular-component-router

Components and use of Angular modules in Angular 1.5


I am trying to adopt the new .component released in angular 1.5. Although I am having a tough time understanding where modules fit in now.

Before I used to separate my components into angular modules, what relationship does this have now that components are here ?

Just create one angular module and add all components under this, or continue to use angular modules as well as components ?

The documentation doesn't seem to go into this. If I am still using modules then what is the use of components, or if I am using components what is the use of more than 1 module ?


Solution

  • Components in Angular 1.5 are special kind of directives which are suitable for component based architecture. They are more like directives on steroids.

    Before I used to separate my components into angular modules, what relationship does this have now that components are here ?

    Now that the components are there you can separate related components into different modules.

    Just create one angular module and add all components under this, or continue to use angular modules as well as components ?

    You can use the same pattern you used before to separate out the controllers.

    components in angular 1.5 help you create actual components that have their own view and bindings. They were created to allow angular 1.5 devs understand the pattern and migrate easily to Angular 2.0 later.