-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Can't upgrade from beta.7 to beta.8-10 #7709
Comments
Hi, |
beta.8 includes a breaking change regarding provider registration, see Maybe that's related? |
Same on beta13. The core of issue was attempt to register new filter in third party library. angular.module('ng').filter('tel', function (){}); There are few libraries with behavior like this. It will be great to add init/lock life cycle and say directly that ng module is prohibited for extension. |
Please post a repro, it's possible that it's a regression |
Nevermind, I can reproduce this with http://plnkr.co/edit/txehajjSSoMV71at9Ygc?p=preview I'll look into this today |
The reason this happens is because now, $providers are always run before config blocks --- however in the case of the This is a breaking change that wasn't mentioned in the changelog, unfortunately. |
Anyways, I'll put together a fix for this (but I'm not sure "extending" the ng module was ever really a supported use case) |
…/etc Due to a regression in c0b4e2d, it is no longer possible to add new controllers, directives, filters, or animations to the `ng` module. This is becuase `config` blocks are always evaluated after regular invoke blocks, and the registration of these types depend on angular's config blocks to have been run. This solution simply ensures that `ng`'s config blocks are run before its invoke blocks are run. Closes angular#7709
@ifyify I feel like this falls under the category of "probably not the best way to do things." What are the 3rd party libraries that do this? If they are open source and on GitHub, I'd like to file issues against them. |
I agree with Brian, on this one, fwiw, it's really a bizarre thing to do |
Congrats, this example now lives here: 🎊 https://github.com/angular/angular-component-spec#bad-practices ✨ |
this is invalid use of our apis. please create a module for your stuff rather than piggy-back on the ng module. |
If mine subcontractors did that, anyone else can do it again. You have great URL based error explanation: extend it to bad practices (for non production code base) attach to discussion thread and it will be really great. It is the C style int32 problem, solve it and people will love you... ./F On Jun 24, 2014, at 14:45, Igor Minar [email protected] wrote:
|
Honestly, I don't think it even makes sense to document this more thoroughly.
There are so many more important things for us to work on. |
What is the solution to this issue? |
@digish777, this issue is about a very old Angular 1.x version (1.3.0.beta.8 specifically). |
My office is trying to upgrade from 1.2.2 to 1.5. this filter is standing in the way. do not know how to fix this. that is why I asked. |
http://plnkr.co/edit/txehajjSSoMV71at9Ygc?p=preview This is exactly what is happening to me. |
Uncaught Error: [$injector:modulerr] Failed to instantiate module ng due to: |
I found the issue is happening at 1.3.0-beta.8. What got changed and how to fix it.? |
The cause of the problem is explained in the comments above. In a nutshell, you should not be putting stuff on the The proper way to solve this is to create your own module and add that as a dependency to your other modules. E.g.: angular.
module('utils', []).
filter('tel', function() { ... });
angular.
module('test', ['utils']).
run(function(telFilter) {
console.log(telFilter);
}); The hacky, unrecommended, non-future-proof way to work around it is: angular.
module('ng').
config(function($filterProvider) {
$filterProvider.register('tel', function() { ... });
}); |
My case was,in my HTML file, I have declared ng-app="MyApplication" in two places. |
After upgrade beta.7 to beta.10 I got the following error.
Error present since beta.8
Uncaught Error: [$injector:modulerr] Failed to instantiate module ng due to:
Error: [$injector:unpr] Unknown provider: $filterProvider
http://errors.angularjs.org/1.3.0-beta.10/$injector/unpr?p0=%24filterProvider
at http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:78:12
at http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:3805:19
at Object.getService as get
at runInvokeQueue (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:3883:43)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:3893:11
at Array.forEach (native)
at forEach (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:320:11)
at loadModules (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:3875:5)
at createInjector (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:3815:11)
at doBootstrap (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.js:1476:20)
http://errors.angularjs.org/1.3.0-beta.10/$injector/modulerr?p0=ng&p1=Error…pis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.0-beta.10%2Fangular.js%3A1476%3A20) angular.js:78
The text was updated successfully, but these errors were encountered: