0
我创建angularjs指令:与angularJs指令问题
'use strict';
angular.module('frontend')
.directive('overall', function() {
return {
restrict: 'E',
scope: {
data: '=data'
},
templateUrl: 'app/components/overall/overall.html',
controller: function($scope) {
alert($scope.data)
}
};
});
和模板是为他
<div id="inner-overall">
Taras
</div>
它之后在其他页我用我的指示是这样的:
<overall data></overall>
和js代码:
$scope.data = 'daadad';
但它不工作,我赶上空的$ scope.data值。 我不知道为什么会发生,以及如何解决它,请帮助我解决这个问题。非常感谢!
非常感谢,这是我的固定的问题等。 –
@TarasKovalenko欢迎您:)请标记接受:) –