On the video watch page with the url
/watch/video_id
, I had a ng app. The directive is shown as below.
app.directive('myApp', function() {
return {
restrict: 'E',
templateUrl: 'ng-templates/myTemplate.html',
link: function(scope, elem, attrs) {
},
controller: 'Controller'
};
});
Since the templateUrl is the relative path, it will try to find the template in
'/watch/ng-templates/myTemplate.html'
which is an error.
I want to put all the templates in the ng-templates folder. But it won't work if the ng app always looks for the relative path. Is there a way to configure the app making it to look for '/ng-template/myTemplate.html'?
Did you try to add leading slash to templateUrl, like
templateUrl: '/ng-templates/myTemplate.html',
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With