I am little confused to differentiate between Component vs Controller. How Controller replaced with component in angular 2? I read about component:
In Angular, a Component is a special kind of directive that uses a simpler configuration which is suitable for a component-based application structure.
This makes it easier to write an app in a way that's similar to using Web Components or using Angular 2's style of application architecture.
Advantages of Components:
- simpler configuration than plain directives
- promote sane defaults and best practices
- optimized for component-based architecture
- writing component directives will make it easier to upgrade to Angular 2
When not to use Components:
- for directives that need to perform actions in compile and pre-link functions, because they aren't available
- when you need advanced directive definition options like priority, terminal, multi-element
- when you want a directive that is triggered by an attribute or CSS class, rather than an element.
Also, Read difference between Directive vs Component
But I am implementing same logic in component which we are doing in controller.
So can someone explain about the same? And How to think about the architecture of the application in component perspective over controller.