btford / btford/angular-modal

$compile before $animate

Open
#27 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
231
Forks
55
PR merge metrics
No merged PRs in 30d

Description

I am having a weird problem where the element doesn't get compiled in time for $animate to properly add the animation classes. I have a directive within the template. If I move the `$animate.enter` line after `$compile`, then everything works as intended. I have been unable to reproduce the problem in isolation. Any ideas?

``` javascript
function attach (html, locals) {
element = angular.element(html);
if (element.length === 0) {
throw new Error('The template contains no elements; you need to wrap text nodes')
}
// original $animate
scope = $rootScope.$new();
if (locals) {
for (var prop in locals) {
scope[prop] = locals[prop];
}
}
var ctrl = $controller(controller, { $scope: scope });
if (controllerAs) {
scope[controllerAs] = ctrl;
}
$compile(element)(scope);
$animate.enter(element, container); // new $animate
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.