-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial work for Aot support #13
Conversation
function makeProviders(module: StatesModule, forRoot: boolean): Provider[] { | ||
let providers: Provider[] = [module.configClass] | ||
.filter(identity) | ||
.map(configClass => ({ provide: configClass, useClass: configClass })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no way to provide conditional service in AOT, users must define configClass manually
Before:
@NgModule({
imports: [
UIRouterModule.forRoot({ configClass: MyUIRouterConfig }),
],
})
export class AppModule {}
After:
@NgModule({
imports: [
UIRouterModule.forRoot({ configClass: MyUIRouterConfig }),
],
providers: [
{ provide: MyUIRouterConfig, useClass: MyUIRouterConfig }
],
})
export class AppModule {}
@kolkov make sure you are using ui-router-core |
Thanks @aitboudad, but where can I find v1.0? |
|
I try to build my test app with this builded version:
Is it ui-router error or not? |
not sure if it's related, currently I'm using the typescript version not the build one and it's work as expected. |
No, I reinstall |
I have found what causes this problem in my case: |
I try to build simple app from angular-cli starter.
Only this code I add to starter.
|
@kolkov did you try to use a export function call? Like this: angular/angular#11262 |
Is it correct?
|
@tonimoeckel If I comment
|
@kolkov you should build using import {UIRouterModule} from ' ../node_modules/ui-router-ng2/src/ng2'; |
@aitboudad I use ` |
yep, I'll try to fix those warning in the next few days but it should work! |
@aitboudad Thanks! Very good news for us! It's work! |
How can we rewrite resolve in Starter?
|
I rewrote my great app using beta.4 and AoT. |
How soon we could use ui-router without aot problems? Cause now it still a problem |
Wow, great work everyone. I'm trying to get angular-ui-router release candidate out the door. After that I'll give this PR the attention it deserves! |
I can't get it to work. I tried all the proposed solutions in this thread. Nada... Can you pls rehost the working demo? |
Also looking for the solution to this... :/ |
@mackelito this worked for me |
@kolkov can you create some kind of demo, of how you made ui-router work with AOT? Thanks. |
@kolkov so you added the index.d.ts file in "/node_modules/ui-router-ng2/"? or is that in your project dir? |
@lexigren I've just created a demo with a working version of ui-router-ng2 with AoT enabled. It is based on the latest "dev" branch of @aitboudad fork (see commit: b649735 ) |
@@ -41,7 +41,7 @@ export type NgModuleToLoad = string | ModuleTypeCallback; | |||
* - Returns the new states array | |||
*/ | |||
export function loadNgModule(moduleToLoad: NgModuleToLoad): (transition: Transition) => Promise<LazyLoadResult> { | |||
return function(transition: Transition) { | |||
return (transition: Transition) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why this was necessary? I don't see any this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use function
it should be exported, it will not work with AoT when it is passed to an NgModule
This is epic! |
what is the winning config for all of us angular-cli users now? unfortunately the config of @tonimoeckel wont let cli start, just giving the old error msg (not using the aot flag) |
@christopherthielen can we tag a |
@christopherthielen @aitboudad I tried compiling under
[edit]: note, I am not using the |
See angular/angular-cli#3854 (comment) Apparently the CLI has issues resolving dependencies when nested |
No description provided.