6. function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
previousCompileContext) {
...
var compositeLinkFn =
compileNodes( compileNodes, transcludeFn, $compileNodes,
maxPriority, ignoreDirective, previousCompileContext);
...
Create all the DDO’s
Execute all DDO’s template property or function
Execute all DDO’s compile functions
return function publicLinkFn(scope, cloneConnectFn, transcludeControllers) {
...
};
}
Execute all DDO’s controllers
Execute all DDO’s preLink functions
Execute all DDO’s postLink functions
7. function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority,
ignoreDirective, previousCompileContext) {
...
for (var i = 0; i < nodeList.length; i++) {
attrs = new Attributes();
Scan the DOM (DFS) and find all directives
Sort the directive by priority
directives = collectDirectives(nodeList[i], [], attrs,
i === 0 ? maxPriority : undefined, ignoreDirective);
nodeLinkFn = (directives.length)
? applyDirectivesToNode(directives, nodeList[i], attrs, ...)
: null;
...
Execute the directive factory and store the DDO
Call to the DDO.template
Call to the DDO.compile
childLinkFn = (nodeLinkFn ...) ? null : compileNodes( childNodes , ...);
...
}
...
}
Execute the compileNodes on the child nodes of
nodeList[i]