Comments (5)
are you on the official beta.3
build? I don't think beta.3
supports the callback to loadNgModule
yet.
beta.4
and beta.5
are going to change ng module loading significantly. stay tuned.
from angular.
Hello, I am on the official beta.4 build and run into the same issue when I used the callback function to lazy load.
Following the docs I also tried this way to lazy load the module
var stocksState = {
name: 'stocks',
url: '/stocks',
lazyLoad: loadNgModule('stocks/client/components/app.module.child#ChildAppModule')
}
In the systemjs.config
I got this error
ui-router-ng2.js:6374 TransitionRejection(type: 6, message: The transition errored, detail: Error: DI Error)
$defaultErrorHandler @ ui-router-ng2.js:6374
(anonymous) @ ui-router-ng2.js:6706
e.invoke @ zone.min.js:1
onInvoke @ core.umd.js:4427
e.invoke @ zone.min.js:1
t.run @ zone.min.js:1
(anonymous) @ zone.min.js:1
e.invokeTask @ zone.min.js:1
onInvokeTask @ core.umd.js:4418
e.invokeTask @ zone.min.js:1
t.runTask @ zone.min.js:1
a @ zone.min.js:1
invoke @ zone.min.js:1
ui-router-ng2.js:6376 Error: DI Error
at NoProviderError.d (http://localhost:3000/vendor/zonejs/dist/zone.min.js:1:11171)
at NoProviderError.BaseError [as constructor] (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:1186:20)
at NoProviderError.AbstractProviderError [as constructor] (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:1371:20)
at new NoProviderError (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:1411:20)
at ReflectiveInjector_._throwOrNull (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:3394:23)
at ReflectiveInjector_._getByKeyDefault (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:3433:29)
at ReflectiveInjector_._getByKey (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:3380:29)
at ReflectiveInjector_.get (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:3140:25)
at AppModuleInjector.NgModuleInjector.get (http://localhost:3000/vendor/@angular/core/bundles/core.umd.js:8996:56)
at loadModuleFactory (http://localhost:3000/vendor/ui-router-ng2/_bundles/ui-router-ng2.js:8501:28)
at eval (http://localhost:3000/vendor/ui-router-ng2/_bundles/ui-router-ng2.js:8481:16)
at lazyLoadState (http://localhost:3000/vendor/ui-router-ng2/_bundles/ui-router-ng2.js:6098:30)
at eval (http://localhost:3000/vendor/ui-router-ng2/_bundles/ui-router-ng2.js:6069:40)
at Array.map (native)
at lazyLoadHook (http://localhost:3000/vendor/ui-router-ng2/_bundles/ui-router-ng2.js:6069:10)
I search the github issues and found that somebody reported the similar issue before but type of TransitionRejection is 6 which is different.
The above lazy loading works well if I use @angular/router but I strongly hope that ui-router-ng2 can support this well too. We built a large angular1 app intensively depending on the ui-router. Now we immigrate to ng2 I do not want to go away from ui-router.
from angular.
Possibly related angular/angular#14343
from angular.
"No NgModule metadata found for '[object Object]"
In the setup which I had in angular/angular#14343 the part [object Object]
resolved to a correct module class name. Further I had a pure Angular2 setup with @angular/router and hadn't to use System.import
myself to load the module.
Given that the error message printed for @lexigren is logged by the same piece of angular code like it is in my case, then the code which produces the message attempts to infer the class name from decorator metadata. If the class name resolves to [object Object]
in @lexigren's case it may indeed be the case that the result returned by the SystemJS-Promise callback does not match with what angular expects.
@lexigren If you explore angular/angular#14343 you'll see that what is exported in my case is the result of a _decorate()
call. Not sure what the value of result.ProductsModule
is in your case. I guess the issue might be easier to investigate if you could provide the part of product.module where the class is decorated and exported as well as your SystemJS Loader config, if that's possible.
from angular.
Lazy loading has changed significantly since this issue was filed. I don't think the issue is relevant anymore. If it's still an issue, please let me know and we can reopen. Please view the sample app for and the lazy loading guide for current lazy loading practices.
from angular.
Related Issues (20)
- Error: State 'quizzes' is already defined HOT 2
- uiSref doesn't work unless matching "name". Can't use full path/name. HOT 2
- How to lazy load with chunks HOT 11
- Incompatibility with Angular v13 - removal of `NgModuleFactoryLoader` HOT 1
- Angular 13 Support (libs update) and version policy HOT 13
- [Discussion] Monorepo requirements for ui-router packages HOT 11
- Redirects on local anchor reference HOT 2
- onError not redirecting HOT 1
- Angular v14 support HOT 2
- [bug(?)]: future state declaration's data not passed/merged to/with loaded child state HOT 1
- Angular 15 support HOT 5
- MergeInjector breaks normal Angular DI priority HOT 3
- [question] Lazy loaded module empty after creating
- Breaks when building with Angular 16
- Angular 16 support HOT 9
- Angular 17 support HOT 4
- Incorrect Ui Routing on iOS 17 safari private browsing mode.
- Example for angular 17 standalone
- Can't use extended StateDeclaration as a generic to StateObject
- Angular 18 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.