From e61711688e33115568b53b5a75e6e8a3525d0f93 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 26 Feb 2016 14:24:41 -0800 Subject: [PATCH] [Templates] Use templateLinker from MCTContainer ...for compatibility with both template and templateUrl. --- platform/commonUI/general/bundle.js | 1 + .../general/src/directives/MCTContainer.js | 22 +++++-------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/platform/commonUI/general/bundle.js b/platform/commonUI/general/bundle.js index 71c5890947..f6cfa63e62 100644 --- a/platform/commonUI/general/bundle.js +++ b/platform/commonUI/general/bundle.js @@ -319,6 +319,7 @@ define([ "key": "mctContainer", "implementation": MCTContainer, "depends": [ + "templateLinker", "containers[]" ] }, diff --git a/platform/commonUI/general/src/directives/MCTContainer.js b/platform/commonUI/general/src/directives/MCTContainer.js index f65cf0803d..18712c6850 100644 --- a/platform/commonUI/general/src/directives/MCTContainer.js +++ b/platform/commonUI/general/src/directives/MCTContainer.js @@ -42,18 +42,12 @@ define( * @memberof platform/commonUI/general * @constructor */ - function MCTContainer(containers) { + function MCTContainer(templateLinker, containers) { var containerMap = {}; // Initialize container map from extensions containers.forEach(function (container) { - var key = container.key; - containerMap[key] = Object.create(container); - containerMap[key].templateUrl = [ - container.bundle.path, - container.bundle.resources, - container.templateUrl - ].join("/"); + containerMap[container.key] = container; }); return { @@ -73,9 +67,11 @@ define( var key = attrs.key, container = containerMap[key], alias = "container", - copiedAttributes = {}; + copiedAttributes = {}, + changeTemplate = templateLinker.link(scope, element); if (container) { + changeTemplate(container); alias = container.alias || alias; (container.attributes || []).forEach(function (attr) { copiedAttributes[attr] = attrs[attr]; @@ -83,15 +79,7 @@ define( } scope[alias] = copiedAttributes; - }, - - // Get the template URL for this container, based - // on its attributes. - templateUrl: function (element, attrs) { - var key = attrs.key; - return containerMap[key].templateUrl; } - }; }