Reputation: 12295
I know it is possible to create custom HTML5 elements/widgets in AngularJS by creating directives.
I recently been looking into Polymer. Another framework that makes creating custom elements easy as well. However, Polymer uses native HTML5 APIs like the ShadowDOM, which AngularJS doesn't.
Note: I am only thinking of creating custom elements/widgets for the latest browsers.
It looks like both AngularJS and Polymer can do the job done. But what are the pros and cons of the two libraries?
Upvotes: 3
Views: 1477
Reputation: 24109
Polymer utilizes the Custom Elements to create new elements in HTML. This is a new W3C specification being added to the browsers. The benefit is that the API is native to the browser and potentially more performant than a JavaScript library equivalent.
Angular directives are conceptually similar to Custom Elements but they're implemented with custom JavaScript. They don't use a standard API...having been created before Custom Elements existed. Angular has said they'll move to using the specifications like Shadow DOM, Custom Elements, etc. in the future.
I've also answered the differences between Angular and Polymer more in depth at What is the difference between Polymer elements and AngularJS directives?
Upvotes: 7