Angular directive;
.directive('ngFilemanager', function () {
return {
restrict: 'EA',
scope: {
thefilter: '=',
},
link: function (scope, element, attrs) {
},
templateUrl: '/templates/filemanager.html',
controller: FileManagerController
}
Html:
<div id="testcontainer" ng-controller="OtherController">
...
<div ng-click="vm.myfunction">Set Filter</div>
...
<div id="thefilemanager" ng-filemanager thefilter=""></div>
...
</div>
How can i set thefilter value in a function of OtherController?
I tried setting the attribute value by jquery but my ng-view isn't updated correctly then.
scope.thefilter = "value"?=) means you want to map in a controller scoped property. The controller that wraps thedivcan have property namedfilterand then, you would pass it intheFilter.thefilter="filter". Then if you change in the directive the changes would be seen.thefilter="myfilter"in this does not work