-
Notifications
You must be signed in to change notification settings - Fork 27.4k
(bug) ngAnimate options.domOperation is not a function #11713
Comments
It happens in our app as well. |
@seldary, can you provide hash of the commit v1.4.0-beta.6, please? |
Can you try to isolate the problem and put a repro in a plnkr etc.? |
I recreated the issue, as isolated as possible. It fails on the call to $digest here (angularStrap code): function safeDigest(scope) {
scope.$$phase || (scope.$root && scope.$root.$$phase) || scope.$digest();
} |
it's not bug of the angular-strap. I wrapped all calls of |
The API for animations has changed a bit, so it's alos possible that angular-strap needs to change something. |
@mgcrea what do you think about that? |
I've not investigated this issue due to lack of time, but I know that I'd like to keep Ideally we should try to come up with a simple failing test. Had glimpse at the changelog, it looks like the issue might come from c8700f0, especially the new auto-digest on chained promise breaking change. For reference, AngularStrap uses this code for its tooltip (and therefore all derivatives), the choice was historically made to manually manage local-only digests on the tooltip scope during show/hide events to prevent triggering full root digests on every tooltip-enabled element hovering. // Hide any existing tipElement
if(tipElement) destroyTipElement();
// Fetch a cloned element linked from template
tipScope = $tooltip.$scope.$new();
tipElement = $tooltip.$element = tipLinker(tipScope, function(clonedElement, scope) {});
// Set the initial positioning. Make the tooltip invisible
// so IE doesn't try to focus on it off screen.
tipElement.css({top: '-9999px', left: '-9999px', display: 'block', visibility: 'hidden'});
// Append the element, without any animations. If we append
// using $animate.enter, some of the animations cause the placement
// to be off due to the transforms.
after ? after.after(tipElement) : parent.prepend(tipElement);
$tooltip.$isShown = scope.$isShown = true;
safeDigest(scope);
// Now, apply placement
$tooltip.$applyPlacement();
// Once placed, animate it.
// Support v1.3+ $animate
// https://github.com/angular/angular.js/commit/bf0f5502b1bbfddc5cdd2f138efd9188b8c652a9
var promise = $animate.enter(tipElement, parent, after, enterAnimateCallback);
if(promise && promise.then) promise.then(enterAnimateCallback);
safeDigest(scope);
$$rAF(function () {
// Once the tooltip is placed and the animation starts, make the tooltip visible
if(tipElement) tipElement.css({visibility: 'visible'});
}); A potential fix for if(promise && promise.then) promise.then(enterAnimateCallback);
else safeDigest(scope); But that would break I'll try to investigate further in the coming days. |
The bug has nothing to do with digests. The issue is that there is a function being passed in to the final parameter of var promise = $animate.enter(tipElement, parent, after, enterAnimateCallback); So towards the end of the function enterAnimateCallback() {
scope.$emit(options.prefixEvent + '.show', $tooltip);
} Long story short, the final param needs to be omitted for 1.3+ (due to promises). So @mgcrea do you have a clean way of doing this? We could patch ngAnimate to ignore non-object params for the 4th parameter but you would still be doing this in 1.3. |
Maybe not only angular-strap doing it, if it was valid in previous versions... Maybe it's the breaking change that should be announced. Or @matsko could make it non-breaking by additional check. |
…passed in Earlier versions of Angular expected a function to be passed into the same param as the options value. This causes a nasty issue since the internal animation code expects the options value to be an object instead of a function. This patch adds the code to convert a function value into an empty object when that occurs. Closes angular#11713
In this situation it's better to have the 1.4 $animate code do the checking: #11826 |
…passed in Earlier versions of Angular expected a function to be passed into the same param as the options value. This causes a nasty issue since the internal animation code expects the options value to be an object instead of a function. This patch adds the code to convert a function value into an empty object when that occurs. Closes angular#11713
…hods As of bf0f550 (released in 1.3.0) it is no longer valid to pass a callback to the following functions: `enter`, `move`, `leave`, `addClass`, `removeClass`, `setClass` and `animate`. To prevent confusing error messages, this change asserts that this parameter is not a function. Closes angular#11826 Closes angular#11713
…hods As of bf0f550 (released in 1.3.0) it is no longer valid to pass a callback to the following functions: `enter`, `move`, `leave`, `addClass`, `removeClass`, `setClass` and `animate`. To prevent confusing error messages, this change asserts that this parameter is not a function. Closes #11826 Closes #11713
Fixed in angular-strap by mgcrea/angular-strap@afd4fc7, thanks @matsko for the bug insights. |
…hods As of bf0f550 (released in 1.3.0) it is no longer valid to pass a callback to the following functions: `enter`, `move`, `leave`, `addClass`, `removeClass`, `setClass` and `animate`. To prevent confusing error messages, this change asserts that this parameter is not a function. Closes angular#11826 Closes angular#11713
Few days ago at production error occured:
TypeError: options.domOperation is not a function
options.domOperation();
angular...mate.js (line 2747, col 8)
https://github.com/angular/angular.js/blob/master/src/ngAnimate/animateQueue.js#L432
First I don't have this error at local machine, but after update Bower dependencies(bower update) I got it.
Here is my bower.json
...
"angular": "~1.4.0",
"angular-animate": "~1.4.0",
...
The text was updated successfully, but these errors were encountered: