Angular 1.5 introduces components:
In Angular, a Component is a special kind of directive that uses a simpler configuration which is suitable for a component-based application structure.
I can't really seem to find any advantages to using them over directives. From what I can tell, they have fewer features (eg. no morecompile
or link
functions) and introduce some mildly different syntax.
The documentation to use it because it's "simpler" and will help transition to Angular 2, but we still have directives in Angular 2, right? Is there any reason I should be converting my directives to components in my Angular 1.5 app?
A Component has view, its part of the UI. A directive does not.
This is that simple, if your element has a view/template then its a component. If it just need to get a hold of the element, change attribtues, register to events -> directive.
In angular 1 a component is facade for directives. In other words, a component (in angular 1.5+) is a factory for creating directives. Using component is the best practice since it creates directives the "right" way. Directives in Angular1 are super configurable and has lots of lots of options which leads to poor implementation and poor PR for angular :) So the component was added to help developers in creating directives the right way (no scope, consistent controller as, etc...)