I am working with an AngularJS directive that has a non-isolated scope, but I have one variable, "isOpen," that needs to be isolated within the directive. Consider the following example:
app.directive('myDir', function() {
return {
restrict: 'A',
scope: {},
link: function(scope, element, attrs) {
scope.isOpen = false;
}
}
});
While this code provides an isolated scope for the directive, I need to find a way to assign a controller before myDir so that its scope is accessible inside myDir. At the same time, I want to ensure that scope.isOpen remains isolated to allow multiple instances of this directive on a single page.