aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2014-06-25 20:53:40 -0400
committerTeddy Wing2014-06-25 20:53:40 -0400
commit0f134b2c8e02bbd8690516f42680e8be715af481 (patch)
tree3b275f3fc621f98037cb2f74c830ef9dbeb000b7
parentb5af5fc5248ba2f2b10131ff3402febc695e6795 (diff)
downloadnsPopover-0f134b2c8e02bbd8690516f42680e8be715af481.tar.bz2
Isolate popover directive scopeisolate-popover-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.
-rw-r--r--src/nsPopover.js1
1 files changed, 1 insertions, 0 deletions
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,