Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Representation] Remove mct-representation/mct-include elements when key not found #195

Closed
VWoeltjen opened this issue Oct 19, 2015 · 3 comments
Assignees
Milestone

Comments

@VWoeltjen
Copy link
Contributor

When attempting to use either an mct-representation or mct-include for which a matching key does not exist, remove the element from the DOM instead of simply leaving it empty. (Additionally, this means adding it back to the DOM if at some future point the representation/include becomes valid; see ng-if)

@charlesh88 has requested this feature as it simplifies the use of Flex layouts in templates where some part of the template needs to be presented differently depending on whether or not some other template/representation is present.

@VWoeltjen VWoeltjen added this to the Ballard milestone Oct 19, 2015
@VWoeltjen VWoeltjen self-assigned this Oct 19, 2015
VWoeltjen added a commit that referenced this issue Oct 28, 2015
...from mct-include. Improves behavior of that directive and supports
testing of changes to remove whole elements when inapplicable,
#195.
@VWoeltjen
Copy link
Contributor Author

Wanted to solve this with element-level transclusion (adding elements to the DOM only if/when a representation is available) but only one transclude: 'element' directive is allowed per HTML element. This conflicts with any mct-device, ng-if, ng-repeat directives attached to an element.

Will explore simulating the behavior of transclude: 'element' by explicitly swapping out elements with some placeholder (e.g. a comment, as Angular does); this will probably not be much more complicated than using transclude anyway.

@charlesh88
Copy link
Contributor

So, if an mct-rep's key can't be found, it'll be completely replaced with a comment, yes? If so, sounds good.

@VWoeltjen
Copy link
Contributor Author

That is correct, for both mct-include and mct-representation.

Additionally, mct-representation will be replaced with a comment when no domain object is available to represent (e.g. <mct-representation key="'tree'" mct-object=undefined> would be replaced with a comment.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants