Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
refactor(macPopover): Popover will always creates a new scope to prev…
Browse files Browse the repository at this point in the history
…ent polluting original scope

BREAKING CHANGE: Popover is now compiling with a new scope. In order to change anything on the original scope
developer must pass data through an object.

Fixes #181
  • Loading branch information
adrianlee44 committed Sep 16, 2014
1 parent d257205 commit 940759b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/services/popover.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ angular.module("Mac").
#
# Use the scope passed in
if isScope(options.scope)
viewScope = options.scope
viewScope = options.scope.$new()

# Create an isolated scope and extend scope with value pass in
else
viewScope = $rootScope.$new true
if angular.isObject options.scope
angular.extend viewScope, options.scope
viewScope = $rootScope.$new true
if angular.isObject options.scope
angular.extend viewScope, options.scope

# Bind refresh on listener to popover
if popoverOptions.refreshOn
Expand Down Expand Up @@ -349,8 +349,7 @@ angular.module("Mac").
$animate.removeClass popoverObj.element, "active"
$rootScope.$broadcast "popoverWasHidden", popoverObj.id

unless isScope popoverObj.options.scope
removeScope.$destroy()
removeScope.$destroy()

callback?()

Expand Down

0 comments on commit 940759b

Please sign in to comment.