可以在角度1.5.8?
中更改工厂组件的绑定(当我的http-interceptor捕获到错误500时,我想准备一个工厂来显示msgs)
例如。
Thats工厂:
angular.module('app')
.factory('msgFct', ['$log', '$timeout', tuiMsgFct]);
function tuiMsgFct($log, $timeout) {
var module = {};
var self = module;
module.foo = function() {
var node = document.getElementById('js-foo');
node.setAttribute('bar', 'Awesome');
};
return module;
}
设置那些绑定
/// COMPONENT IN DOM
<foo-component id="js-foo" bar=""></foo-component>
//// COMPONENT TEMPLATE
<span>{{fooComponent.bar}}</span>
//// COMPONENT CONTROLLER
angular.module('app').component('fooComponent', {
templateUrl: '...',
controller: fooComponent,
controllerAs: 'fooComponent',
bindings: {
bar: '<'
}
});
function fooComponent() {
var self = this;
}