AngularJs Directives

I haven’t posted much in regards to AngularJS since most of what I would say is already out there to read by someone else. AngularJs is a great technology for the web and if you like the use of includes and templates in your html, you’ll love it. One thing I want to point out though is if you’re not using Angular Directives, then you’re not building your web app properly. Sure it might work, sure you can do things many different ways and not use directives at all but the biggest power in Angular is using Angular Directives.  The ability to create your own html elements which act as custom components.

The tricky part with angular directives is that they are easy to copy and paste from other sources to use and somewhat “easy” to create some really basic ones.  However, it takes time, skill and an understanding of the under lying core and events to really master directives and create your own proper directives that account for performance and calling things in the right order.

There’s a balance between KISS and DRY. On one hand you can get something working quickly with KISS. However if you do plan to repeat yourself elsewhere and want to keep your code DRY then it’s not so simple and a little more complex.

One great book I recommend and reading through twice is Josh Kurz’s Mastering AngularJS Directives.  Where other books just basically repeat what’s in the angular documentation with some better examples, this book goes beyond basic AngularJs and really gets into TDD and Angular Directives. Great book for anyone wanting to get to the next level.

Remember, have an Angular App with no directives at all? Then you need to go back to the drawing board.

AngularJs Select Element, set Label and Value

Joe Healy is the Best!

Joe Healy is the Best!