Does controller share it's scope if I use the directive in one page multiple times? Although I think is not shared, I still want someone to help me understand this point.
If I define the variable 'isWidgetEnabled' in fooController, will it share in both two directives, if I want each directive 'foo' has its own variable, how can I do it?
js:
angular.module("module") .controller("fooController", ["$scope", function($scope) { ... }) .directive("foo", function() { return { restrict: "E", controller: "fooController", link: function($scope, $element, $attrs) { // Do some things with the scope of the controller here } } }); html:
<html> <head> <!-- Scripts here --> </head> <body ng-app="module"> <foo/> <foo/> </body> </html>