I have a table where the rows are repeated via
As Pavlo wrote, you can move the Directive mytemplate.html plunkerng-repeat.
I am trying to create a template that generates columns for each row <
tr element to the template for the directive. Another option is to use a td element and directive that replaces your td with the template that you want to use.
replaceMe.directive("replaceMe", ["$compile", '$http', '$templateCache', function ($compile, $http, $templateCache) {
return {
restrict: 'A',
scope: {
position: "="
},
link: function (scope, element, attrs) {
function getTemplate(template) {
$http.get(template, {cache: $templateCache}).success(function (templateContent) {
element.replaceWith($compile(templateContent)(scope));
});
}
scope.$watch(attrs.template, function () {
if (attrs.template) {
getTemplate(attrs.template);
}
});
}
}
}]);
{{position.Name}}
{{position.Code}}