I am facing a problem with AngularJS. My application starts, then reaches a specific ngView through ngRoute and calls a controller. when the controller is initialize it retrieve
When templateUrl
function runs, the attribute values are still not interpolated.
So, you'd need to load the template at link
time. You can cheaply re-use ng-include
to accomplish that:
.directive("jlTile", function($interpolate){
return {
template: '',
link: function(scope, element, attrs){
var suffix = $interpolate(attrs.jlTile)(scope);
scope.url = "/templates/elements/tile-" + suffix + ".html";
}
}
});