From 8581547a9c3ecee35913e16c9e48a9838d2cabbd Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 26 Feb 2016 14:49:55 -0800 Subject: [PATCH] [Templates] Allow only template property for containers ...to work around difficulties with transclusion using templateLinker. --- docs/src/guide/index.md | 19 ++++++++++++++++++- platform/commonUI/general/bundle.js | 1 - .../general/src/directives/MCTContainer.js | 12 ++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/docs/src/guide/index.md b/docs/src/guide/index.md index f6d22fb2fb..93cb95bb7a 100644 --- a/docs/src/guide/index.md +++ b/docs/src/guide/index.md @@ -910,7 +910,24 @@ A capability's implementation may also expose a static method `appliesTo(model)` which should return a boolean value, and will be used by the platform to filter down capabilities to those which should be exposed by specific domain objects, based on their domain object models. - + +## Containers Category + +Containers provide options for the `mct-container` directive. + +The definition for an extension in the `containers` category should include: + +* `key`: An identifier for the container. +* `template`: An Angular template for the container, including an + `ng-transclude` where contained content should go. +* `attributes`: An array of attribute names. The values associated with + these attributes will be exposed in the template's scope under the + name provided by the `alias` property. +* `alias`: The property name in scope under which attributes will be + exposed. Optional; defaults to "container". + +Note that `templateUrl` is not supported for `containers`. + ## Controls Category Controls provide options for the `mct-control` directive. diff --git a/platform/commonUI/general/bundle.js b/platform/commonUI/general/bundle.js index f6cfa63e62..71c5890947 100644 --- a/platform/commonUI/general/bundle.js +++ b/platform/commonUI/general/bundle.js @@ -319,7 +319,6 @@ 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 18712c6850..e35c52f9f6 100644 --- a/platform/commonUI/general/src/directives/MCTContainer.js +++ b/platform/commonUI/general/src/directives/MCTContainer.js @@ -42,7 +42,7 @@ define( * @memberof platform/commonUI/general * @constructor */ - function MCTContainer(templateLinker, containers) { + function MCTContainer(containers) { var containerMap = {}; // Initialize container map from extensions @@ -67,11 +67,9 @@ define( var key = attrs.key, container = containerMap[key], alias = "container", - copiedAttributes = {}, - changeTemplate = templateLinker.link(scope, element); + copiedAttributes = {}; if (container) { - changeTemplate(container); alias = container.alias || alias; (container.attributes || []).forEach(function (attr) { copiedAttributes[attr] = attrs[attr]; @@ -79,6 +77,12 @@ define( } scope[alias] = copiedAttributes; + }, + + template: function (element, attrs) { + var key = attrs.key, + container = containerMap[key]; + return container ? container.template : ""; } }; }