Check out this quick demo:
Essentially, both
<div data-foo-{{letterA}}></div>
and <div data-ng:model="foo-{{letterB}}"></div>
are not being interpolated.
I'm trying to figure out a way to dynamically load one of multiple inline templates.
Apologies if this question has already been asked, but my search didn't yield any results.
I think Radim Köhler has provided the correct solution. Before their answer, I managed to put together a method to load directives from another directive using the following code:
angular.module('myApp', []).directive('loadTmpl', function($compile) {
return {
restrict: 'A',
replace: true,
link: function($scope, $element, $attr) {
$element.html("<div data-card-"+$attr.loadTmpl+"></div>");
$compile($element.contents())($scope);
}
};
});
And:
<div data-load-tmpl="{{directiveName}}"></div>
I believe this is the most minimalistic approach, but there may be some issues with it, so please refer to the answer below for more details.