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

0.13.0 does not work with async loading #3665

Closed
lapo-luchini opened this issue May 13, 2015 · 5 comments
Closed

0.13.0 does not work with async loading #3665

lapo-luchini opened this issue May 13, 2015 · 5 comments

Comments

@lapo-luchini
Copy link

I recently updated from 0.12.x to 0.13.0 and I have a few errors, the first I found is in the last line of both ui-bootstrap.js and ui-bootstrap-tpls.js: the function angular.$$csp() is called possibly before Angular itself is loaded. I fixed this wrapping it in a module run (and adding it to the dependencies in the first line):

angular.module('ui.bootstrap.csp', []).run(function () {
  !angular.$$csp() && angular.element(document).find('head').prepend('<style type="text/css">.ng-animate.item:not(.left):not(.right){-webkit-transition:0s ease-in-out left;transition:0s ease-in-out left}</style>');
});

I'd gladly produce a PR but I don't understand from which source code is that line built. I also noticed it's also present in angular.js so maybe it could be avoided altogether?

@rvanbaalen
Copy link
Contributor

Please provide a plunkr reproducing this problem.

@lapo-luchini
Copy link
Author

Here goes the plunkr.

I forgot to say that this only happens when using <script async> (with angular-loader of course).

@rvanbaalen
Copy link
Contributor

This seems like something @chrisirhc was involved with. Perhaps he can take a look.

@rvanbaalen rvanbaalen added this to the Backlog milestone May 18, 2015
@rvanbaalen
Copy link
Contributor

Looking into it, this seems like a question suitable for StackOverflow. It's not actually a bug with this library, it's an issue you have when using this library in a certain manner that we don't support out of the box.

Indeed, one could expect UI Bootstrap to work in this situation and it would help if we implement a fix for it but basically this is an enhancement request instead of a bug.

@lapo-luchini
Copy link
Author

AngularJS module system supports out-of-order loading by default (using the official async loader), this only happens because angular.$$csp is currently used in the global namespace instead of inside a module, wrapping it with a module.run should solve the problem as far as I can see. (of course, the code would be executed as soon as the module and all his dependencies is loaded, not as soon as it's singularly loaded, but I guess that's ok)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants