Mastering AngularJS Directives by 2014

Mastering AngularJS Directives by 2014

Author:2014
Language: eng
Format: epub, mobi
Publisher: Packt Publishing


These use cases make up the majority of the directives that utilize dynamic DOM creation and breakdown. Transclusion is not apparently calling the compile function, but don't let the genius of the AngularJS framework confuse you. Transclusion is nothing more than a mechanism to rip a piece of a DOM out of the tree during the compile phase and storing its transpiled link function in the memory to be called at a later time.

The recursive directives are built on the idea of transclusion and use its optimized ideologies to create complex DOM elements with very minimal code. These DOM elements are semantically much more simple than their static counterparts which use many lines to accomplish what the recursive directives can do in much less. To show case transclusion and recursion, we created a treeNode directive that accomplishes the same functionality in two different ways.

Dynamic template-based directives are the bases for two major AngularJS core directives. The ngInclude and ngView directives are the two major directives that allow applications to control HTML in a simplified and organized format. To showcase the power of template-based directives, we created a mediaPlayer directive. The mediaPlayer directive can compile any template that has been placed in AngularJS's $templateCache. This is so that the directive can work in an almost perfectly synchronous manner, speeding up the entire compile and linking processes.

The benefits of using the compile function in an application are enormous. The compile service is a sword yielded by only the strongest and most apt AngularJS developers and once its process is mastered, the rest of the way becomes simpler.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.