Reputation: 22183
I'm not having any luck setting the bindings within a directive that fetches a template from a templateUrl.
Here's what the inside of my binding code looks like:
templateUrl : '/path/to/template.html',
link : function($scope, element, attrs) {
$scope.title = 'test';
}
And here's what the template itself looks like:
<div>
<h4>{{title}}</h4>
</div>
The directive is fired for a data-video attribute. The directive itself gets fired and downloads the template, but the scope bindings are not replaced.
Any ideas on how to do this?
Upvotes: 1
Views: 7191
Reputation: 37785
What you have looks good to me here are some suggestions:
{{title}
isn't a typo make sure you use {{title}}
instead.replace: true
set make sure your html file doesn't have any comments outside the root level per this post.function(scope, element, attrs)
Upvotes: 3