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

Function compileTemplateUrl

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

Source from the content-addressed store, hash-verified

10322
10323
10324 function compileTemplateUrl(directives, $compileNode, tAttrs,
10325 $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
10326 var linkQueue = [],
10327 afterTemplateNodeLinkFn,
10328 afterTemplateChildLinkFn,
10329 beforeTemplateCompileNode = $compileNode[0],
10330 origAsyncDirective = directives.shift(),
10331 derivedSyncDirective = inherit(origAsyncDirective, {
10332 templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
10333 }),
10334 templateUrl = (isFunction(origAsyncDirective.templateUrl))
10335 ? origAsyncDirective.templateUrl($compileNode, tAttrs)
10336 : origAsyncDirective.templateUrl,
10337 templateNamespace = origAsyncDirective.templateNamespace;
10338
10339 $compileNode.empty();
10340
10341 $templateRequest(templateUrl)
10342 .then(function(content) {
10343 var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
10344
10345 content = denormalizeTemplate(content);
10346
10347 if (origAsyncDirective.replace) {
10348 if (jqLiteIsTextNode(content)) {
10349 $template = [];
10350 } else {
10351 $template = removeComments(wrapTemplate(templateNamespace, trim(content)));
10352 }
10353 compileNode = $template[0];
10354
10355 if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
10356 throw $compileMinErr('tplrt',
10357 'Template for directive \'{0}\' must have exactly one root element. {1}',
10358 origAsyncDirective.name, templateUrl);
10359 }
10360
10361 tempTemplateAttrs = {$attr: {}};
10362 replaceWith($rootElement, $compileNode, compileNode);
10363 var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
10364
10365 if (isObject(origAsyncDirective.scope)) {
10366 // the original directive that caused the template to be loaded async required
10367 // an isolate scope
10368 markDirectiveScope(templateDirectives, true);
10369 }
10370 directives = templateDirectives.concat(directives);
10371 mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
10372 } else {
10373 compileNode = beforeTemplateCompileNode;
10374 $compileNode.html(content);
10375 }
10376
10377 directives.unshift(derivedSyncDirective);
10378
10379 afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
10380 childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
10381 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