I created a directive in Angular. The directive "compiles" when I use the attribute template. It does not compile when used templateURL.
The templateURL file does not contain 404 in the angular console or network tab. These are 200 browser URLs.
What am I missing?
'use strict';
angular.module('mean.profile').directive('inProfileSidebar', function() {
return {
restrict: 'A',
scope: {
data: '=',
editable: '=',
},
template: '<div><h2>inProfileNarrow</h2><div>{{data}}</div><div>{{editable}}</div></div>',
};
});
My application http://localhost:3000/#!/profile/
url : This url is 200:http://localhost:3000/profile/views/inProfileSidebar.html
inProfileSidebar.html
<div>
<h2>inProfileNarrow</h2>
<div>{{data}}</div>
<div>{{editable}}</div>
</div>
Used in this HTML:
<div class="col-md-4">
<div in-profile-sidebar data="data.profile" editable="data.profile.editable"></div>
</div>
I do not see any errors in the browser console, and there is no request for the URL template in the browser's online log.
It works when I use template, but not with templateURL. Why?
source
share