Is there a way to modify a $scope variable from within an isolated directive?
I've experimented with the '@, =, &' syntax in the directive scope but haven't been successful.
Here's a simplified version of my code:
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>
This is the desired output:
hello world!
this is my text