I've been looking around behind the logic of when someone shall create a new component in a web application on angularjs / angular but I suppose this is more general and might apply on all component based front end frameworks.
I know that there are some principles like it should be abstract and reusable but e.g. I have seen on angular docs that each separate route looks at a specific component (how can this be reusable). Is there any solid question which I might ask before creating a new component ?
What are Angular components? A component is a directive with a template that allows building blocks of a UI in an Angular application. Components will always have a template, a selector, and may or may not have a separate style. Components are declared using @Component.
CLI Component Generation It looks like the CLI automatically created the new folder to hold our new component in app/virtual-machines . In addition we see four new files associated with the automatically generated component.
It will create the following 4 files: componentname. css. componentname.
In order to make a decision whether you have to create a component or not, i think you have to answer the following questions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With