I have a list component where I want to define custom columns inside. These columns get transcluded into the row of the components template. Unfortunately I can't use ngIf in this context.
Here is my $postLink function of the myList component:
const template = $templateCache.get('myList.tpl.html');
const jqTemplate = angular.element(template);
const row = angular.element(jqTemplate.children()[0]);
$transclude(clone => {
row.append(clone);
$element.html(jqTemplate.html());
});
$compile($element.contents())($scope);
Here is a plnkr of the minimal sample: http://plnkr.co/edit/C9Rvs8NiTYsV3pwoPF6a
Is that because of the terminal
property? Can someone entlighten me why ngIf does not work like expect it to?
ng-if
, but your case works with a ng-show/hide. Obviously remove the dom elements and its watchers is not the same than only hidden them by css in terms of performance, but if you don't have a huge amout of rows/cols, maybe you could save a headache :) – Daredevil