Angular Custom Element, AngularJS in Depth

2014-10-17 00:00:00 +0100 by Alex R. Young

Angular Custom Element

Angular Custom Element (GitHub: dgs700 / angular-custom-element, License: MIT) by David Shapiro allows you to use custom elements in a W3C-approved way. This means you can take your declarative markup to the next level.

To register custom tag names you can create custom element providers then call register:

$customElementsProvider.register('tag-name1', { elemConfigObj1 })
  .register('tag-name2', { elemConfigObj2 })
  .register('tag-name3', { elemConfigObj3 });

Once the service has been injected into the matching element directive, it will automatically bind the element's custom properties and attributes. Behind the scenes there is cross browser support, so this should even work in IE9.

If you've never heard of custom elements before, then take a look at Custom Elements at html5rocks.com. The basic argument is to avoid lots of nested div elements by defining reusable, context-specific elements with new behaviour.

The thing that's cool about Angular Custom Element is it lets you think in terms of custom elements, which may help future proof reusable components. Rather than building things that are heavily framework-specific, they can be described in terms of the DOM API.

I also noticed in Dave's readme that he's written a book: Web Component Architecture and Development with AngularJS. This is a pay what you want kind of deal, so be generous if you're interested!

AngularJS in Depth

I've been invited to the AngularJS in Depth early preview. This is a book aimed at people who have already built applications with Angular and want to take their skills to the next level. The first chapter is free, and eleven chapters have been planned so far.

It's written by David L. Aden and Jason L. Aden, and is published by Manning who are also publishing the Node book that I'm working on. The early preview has two chapters so far, but I really like the idea of books aimed at more advanced AngularJS programmers because it's a hard thing to learn well.

AngularJS in Depth costs $39.99 for the early access preview and the final eBook, or $49.99 for the print and eBook versions.