Я хочу изменить переменную $ scope из изолированной директивы, как это возможно?
Я попытался использовать синтаксис '@, =, &' в области директивы, но не могу заставить его работать.
Это мой упрощенный код
JS
app.controller('testCtrl', function($scope) {
$scope.hello = 'hello';
}
app.directive('testDirective', function() {
return {
restrict: 'E',
template: '<div>{{text}}</div>',
scope: {},
link: function(scope, element) {
scope.text = 'this is my text';
scope.hello = 'hello world!';
}
};
});
HTML
<body>
{{ hello }}
<test-directive />
</body>
Это выход я хочу
hello world!
this is my text
Хорошее решение, спасибо! – Inzajt