Dart's Web Component and Angular's Directives look like they serve very similar purposes. Are there any significant differences?
The Component is used to break up the application into smaller components. That is why components are widely used in later versions of Angular to make things easy and build a total component-based model. The Directive is used to design reusable components, which are more behavior-oriented.
Yes, in Angular 2, Components are a type of Directive. According to the Doc, “Angular components are a subset of directives. Unlike directives, components always have a template and only one component can be instantiated per an element in a template.”
What are Directives? At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ( $compile ) to attach a specified behavior to that DOM element (e.g. via event listeners), or even to transform the DOM element and its children.
They serve similar purposes indeed. However Web Components are not a part of Dart, they are a part of browsers. Dart Web-UI does use Web Components (http://www.w3.org/TR/2013/WD-components-intro-20130606/). AngularJS has plans to use them for 2.0 as can be read here: http://www.2ality.com/2013/05/web-components-angular-ember.html
What it comes down to is that a lot of the functionality is shared. But Angular.js has a pure JS implementation and Darts' Web-UI uses browser techniques.
Angular will use the underlying web platform features available to it
(e.g. Node.bind, template integration, Custom Elements, etc...)
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