From 0f134b2c8e02bbd8690516f42680e8be715af481 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 25 Jun 2014 20:53:40 -0400 Subject: Isolate popover directive scope Previously, if multiple popovers were added, they would all share the same scope. I encountered an issue when trying to add several popovers, each with a "close" link that specifying `ng-click="hidePopover()"`. Since all popovers share scope, the `hidePopover()` function only knows about the last popover it saw. This means that only that last popover can be hidden using `hidePopover()`. This change ensures that all popovers have their own scope, so `hidePopover()` will now operate on the correct instance. Fixes #11. --- src/nsPopover.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nsPopover.js b/src/nsPopover.js index d43dc4a..c4626dc 100644 --- a/src/nsPopover.js +++ b/src/nsPopover.js @@ -11,6 +11,7 @@ module.directive('nsPopover', function($timeout, $templateCache, $q, $http, $compile, $document) { return { restrict: 'A', + scope: true, link: function(scope, elm, attrs) { var options = { template: attrs.nsPopoverTemplate, -- cgit v1.2.3