diff --git a/src/popover/test/popover.spec.js b/src/popover/test/popover.spec.js
index 7e6f2b3970..878b5a21f7 100644
--- a/src/popover/test/popover.spec.js
+++ b/src/popover/test/popover.spec.js
@@ -19,7 +19,7 @@ describe('popover', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
}));
it('should not be open initially', inject(function() {
diff --git a/src/tooltip/test/tooltip.spec.js b/src/tooltip/test/tooltip.spec.js
index efb31cb31d..1966f65365 100644
--- a/src/tooltip/test/tooltip.spec.js
+++ b/src/tooltip/test/tooltip.spec.js
@@ -19,7 +19,7 @@ describe('tooltip', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
}));
it('should not be open initially', inject(function() {
@@ -59,7 +59,7 @@ describe('tooltip', function() {
'Selector Text'
) )( scope );
scope.$apply();
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
elm.trigger( 'mouseenter' );
expect( elmScope.tt_placement ).toBe( 'bottom' );
@@ -86,7 +86,7 @@ describe('tooltip', function() {
tt.trigger( 'mouseenter' );
expect( tt.text() ).toBe( scope.items[0].name );
- expect( tt.scope().tt_content ).toBe( scope.items[0].tooltip );
+ expect( tt.isolateScope().tt_content ).toBe( scope.items[0].tooltip );
tt.trigger( 'mouseleave' );
}));
@@ -104,7 +104,7 @@ describe('tooltip', function() {
$compile( elmBody )( scope );
scope.$digest();
elm = elmBody.find( 'span' );
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
elm.trigger( 'mouseenter' );
expect( elm.attr( 'alt' ) ).toBe( scope.alt );
@@ -166,11 +166,11 @@ describe('tooltip', function() {
beforeEach(inject(function ($compile) {
scope.enable = false;
elmBody = $compile(angular.element(
- '
Selector Text
'
+ 'Selector Text
'
))(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
}));
@@ -200,7 +200,7 @@ describe('tooltip', function() {
elm = $compile(angular.element(
'Selector Text'
))(scope);
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
scope.$digest();
}));
@@ -246,7 +246,7 @@ describe('tooltip', function() {
$compile(elmBody)(scope);
scope.$apply();
elm = elmBody.find('input');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
expect( elmScope.tt_isOpen ).toBeFalsy();
elm.trigger('focus');
@@ -262,7 +262,7 @@ describe('tooltip', function() {
$compile(elmBody)(scope);
scope.$apply();
elm = elmBody.find('input');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
expect( elmScope.tt_isOpen ).toBeFalsy();
elm.trigger('fakeTriggerAttr');
@@ -285,8 +285,8 @@ describe('tooltip', function() {
scope.$apply();
var elm1 = elmBody.find('input').eq(0);
var elm2 = elmBody.find('input').eq(1);
- var elmScope1 = elm1.scope();
- var elmScope2 = elm2.scope();
+ var elmScope1 = elm1.isolateScope();
+ var elmScope2 = elm2.isolateScope();
scope.$apply('test = false');
@@ -318,7 +318,7 @@ describe('tooltip', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
var bodyLength = $body.children().length;
elm.trigger( 'mouseenter' );
@@ -351,7 +351,7 @@ describe('tooltip', function() {
$rootScope.$apply();
elm = elmBody.find('input');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
elm.trigger('fooTrigger');
tooltipScope = elmScope.$$childTail;
}));
@@ -415,7 +415,7 @@ describe( 'tooltipHtmlUnsafe', function() {
))( scope );
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
}));
it( 'should render html properly', inject( function () {
@@ -461,7 +461,7 @@ describe( '$tooltipProvider', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
}));
it('should open after timeout', inject(function($timeout) {
@@ -500,7 +500,7 @@ describe( '$tooltipProvider', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
var bodyLength = $body.children().length;
elm.trigger( 'mouseenter' );
@@ -520,7 +520,7 @@ describe( '$tooltipProvider', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
elm.trigger( 'mouseenter' );
expect( elmScope.tt_isOpen ).toBe( true );
@@ -549,7 +549,7 @@ describe( '$tooltipProvider', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('input');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
expect( elmScope.tt_isOpen ).toBeFalsy();
elm.trigger('focus');
@@ -567,7 +567,7 @@ describe( '$tooltipProvider', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('input');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
expect( elmScope.tt_isOpen ).toBeFalsy();
elm.trigger('mouseenter');
@@ -595,7 +595,7 @@ describe( '$tooltipProvider', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('input');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
expect( elmScope.tt_isOpen ).toBeFalsy();
elm.trigger('customOpenTrigger');
@@ -622,7 +622,7 @@ describe( '$tooltipProvider', function() {
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
- elmScope = elm.scope();
+ elmScope = elm.isolateScope();
expect( elmScope.tt_isOpen ).toBeFalsy();
elm.trigger('fakeTrigger');
diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js
index de6d66dc16..c7d2c633ec 100644
--- a/src/tooltip/tooltip.js
+++ b/src/tooltip/tooltip.js
@@ -107,7 +107,14 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
return {
restrict: 'EA',
- scope: true,
+ scope: {
+ // These should be passed into the isolate scope.
+ // example: tooltip-enable="enable"
+ // instead of tooltip-enable="{{enable}}"
+ // but this would be a breaking change.
+// tt_enable: '=' + prefix + 'Enable',
+// tt_animation: '=' + prefix + 'Animation'
+ },
compile: function (tElem, tAttrs) {
var tooltipLinker = $compile( template );
@@ -117,7 +124,6 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
var popupTimeout;
var appendToBody = angular.isDefined( options.appendToBody ) ? options.appendToBody : false;
var triggers = getTriggers( undefined );
- var hasEnableExp = angular.isDefined(attrs[prefix+'Enable']);
var positionTooltip = function () {
@@ -143,7 +149,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
// Show the tooltip with delay if specified, otherwise show it immediately
function showTooltipBind() {
- if(hasEnableExp && !scope.$eval(attrs[prefix+'Enable'])) {
+ if(!scope.tt_enable) {
return;
}
if ( scope.tt_popupDelay ) {
@@ -264,6 +270,11 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
scope.tt_placement = angular.isDefined( val ) ? val : options.placement;
});
+ attrs.$observe( prefix+'Enable', function ( val ) {
+ // using eval so "0" or "false" get evaluated as false
+ scope.tt_enable = angular.isDefined( val ) ? scope.$eval(val) : true;
+ });
+
attrs.$observe( prefix+'PopupDelay', function ( val ) {
var delay = parseInt( val, 10 );
scope.tt_popupDelay = ! isNaN(delay) ? delay : options.popupDelay;
@@ -287,8 +298,10 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
}
});
- var animation = scope.$eval(attrs[prefix + 'Animation']);
- scope.tt_animation = angular.isDefined(animation) ? !!animation : options.animation;
+ attrs.$observe( prefix+'Animation', function ( val ) {
+ // using eval so "0" or "false" get evaluated as false
+ scope.tt_animation = angular.isDefined(val) ? scope.$eval(val) : options.animation;
+ });
attrs.$observe( prefix+'AppendToBody', function ( val ) {
appendToBody = angular.isDefined( val ) ? $parse( val )( scope ) : appendToBody;