MCPcopy
hub / github.com/angular-ui/ui-grid / compileTemplateUrl

Function compileTemplateUrl

lib/test/angular/1.8.0/angular.js:10907–11024  ·  view source on GitHub ↗
(directives, $compileNode, tAttrs,
        $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext)

Source from the content-addressed store, hash-verified

10905
10906
10907 function compileTemplateUrl(directives, $compileNode, tAttrs,
10908 $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
10909 var linkQueue = [],
10910 afterTemplateNodeLinkFn,
10911 afterTemplateChildLinkFn,
10912 beforeTemplateCompileNode = $compileNode[0],
10913 origAsyncDirective = directives.shift(),
10914 derivedSyncDirective = inherit(origAsyncDirective, {
10915 templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
10916 }),
10917 templateUrl = (isFunction(origAsyncDirective.templateUrl))
10918 ? origAsyncDirective.templateUrl($compileNode, tAttrs)
10919 : origAsyncDirective.templateUrl,
10920 templateNamespace = origAsyncDirective.templateNamespace;
10921
10922 $compileNode.empty();
10923
10924 $templateRequest(templateUrl)
10925 .then(function(content) {
10926 var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
10927
10928 content = denormalizeTemplate(content);
10929
10930 if (origAsyncDirective.replace) {
10931 if (jqLiteIsTextNode(content)) {
10932 $template = [];
10933 } else {
10934 $template = removeComments(wrapTemplate(templateNamespace, trim(content)));
10935 }
10936 compileNode = $template[0];
10937
10938 if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
10939 throw $compileMinErr('tplrt',
10940 'Template for directive \'{0}\' must have exactly one root element. {1}',
10941 origAsyncDirective.name, templateUrl);
10942 }
10943
10944 tempTemplateAttrs = {$attr: {}};
10945 replaceWith($rootElement, $compileNode, compileNode);
10946 var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
10947
10948 if (isObject(origAsyncDirective.scope)) {
10949 // the original directive that caused the template to be loaded async required
10950 // an isolate scope
10951 markDirectiveScope(templateDirectives, true);
10952 }
10953 directives = templateDirectives.concat(directives);
10954 mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
10955 } else {
10956 compileNode = beforeTemplateCompileNode;
10957 $compileNode.html(content);
10958 }
10959
10960 directives.unshift(derivedSyncDirective);
10961
10962 afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
10963 childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
10964 previousCompileContext);

Callers 1

applyDirectivesToNodeFunction · 0.70

Calls 15

inheritFunction · 0.70
isFunctionFunction · 0.70
jqLiteIsTextNodeFunction · 0.70
removeCommentsFunction · 0.70
wrapTemplateFunction · 0.70
trimFunction · 0.70
replaceWithFunction · 0.70
collectDirectivesFunction · 0.70
isObjectFunction · 0.70
markDirectiveScopeFunction · 0.70
mergeTemplateAttributesFunction · 0.70
applyDirectivesToNodeFunction · 0.70

Tested by

no test coverage detected