This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
"popoverTemplate" and "popoverTemplatePopup" directives #1046
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
44f19b9
"popoverTemplate" and "popoverTemplatePopup" directives
jbruni 0f5ed4f
Making it work with jqLite
jbruni 1f29094
Added missing semicolons to make jshint happy
jbruni 3e40927
Detaching when only hiding; removing when scope is destroyed
jbruni d3f61c0
Made popover-template directive compatible with AngularJS 1.0.8
jbruni d1127b8
Made popover-template directive compatible with AngularJS 1.0.8
jbruni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap | |
'placement="'+startSym+'tt_placement'+endSym+'" '+ | ||
'animation="tt_animation()" '+ | ||
'is-open="tt_isOpen"'+ | ||
'compile-scope="$parent"'+ | ||
'>'+ | ||
'</'+ directiveName +'-popup>'; | ||
|
||
|
@@ -221,7 +222,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap | |
} | ||
|
||
// Hide the tooltip popup element. | ||
function hide() { | ||
function hide( destroy ) { | ||
// First things first: we don't show it anymore. | ||
scope.tt_isOpen = false; | ||
|
||
|
@@ -232,9 +233,17 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap | |
// need to wait for it to expire beforehand. | ||
// FIXME: this is a placeholder for a port of the transitions library. | ||
if ( angular.isDefined( scope.tt_animation ) && scope.tt_animation() ) { | ||
transitionTimeout = $timeout( function () { tooltip.remove(); }, 500 ); | ||
transitionTimeout = $timeout( function () { remove( destroy ); }, 500 ); | ||
} else { | ||
remove( destroy ); | ||
} | ||
} | ||
|
||
function remove( destroy ) { | ||
if ( destroy ) { | ||
tooltip.remove(); | ||
} else { | ||
angular.forEach( tooltip, function( e ) { e.parentNode.removeChild( e ); } ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
|
||
|
@@ -299,9 +308,9 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap | |
// Make sure tooltip is destroyed and removed. | ||
scope.$on('$destroy', function onDestroyTooltip() { | ||
if ( scope.tt_isOpen ) { | ||
hide(); | ||
hide( true ); | ||
} else { | ||
tooltip.remove(); | ||
remove( true ); | ||
} | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="popover {{placement}}" ng-class="{ in: isOpen(), fade: animation() }"> | ||
<div class="arrow"></div> | ||
|
||
<div class="popover-inner"> | ||
<h3 class="popover-title" ng-bind="title" ng-show="title"></h3> | ||
<div class="popover-content"></div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is sad... |
||
</div> | ||
</div> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this single and simple line, we are able to provide the "compile scope" to the "popup" directive.