У меня есть настройка моего компонента так:
// app/my-component/my-component.js
app.component('myComponent', {
bindings: {
bindingA: '=',
bindingB: '='
},
templateUrl: 'app/my-component/my-component.tpl.html',
controller: MyComponentCtrl
});
// app/my-component/my-component.tpl.html
<div>
<input type="text" ng-model="$ctrl.bindingA" />
<input type="text" ng-model="$ctrl.bindingB" />
</div>
Ошибок не возникает; мой файл шаблонов проявляется просто в Chrome Dev Tools. Предварительный просмотр сети XHR-запроса отображается правильно, но он просто не будет отображаться в DOM...
Если я поменю templateUrl
с template
, строка будет отображаться только в DOM.
Есть идеи?
После того, как я хотел побить голову на клавиатуре, я понял, что этот бит кода мешал бы ответам templateUrl:
$httpProvider.interceptors.push(function() {
return {
'response': function (response) {
response.data = response.data.d;
return response;
}
}
});
Просто изменено на: if (response.data.d) response.data = response.data.d;
Еще один день в жизни я расскажу вам...