-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Please add Ahead of time compile support #119
Comments
Can you go into detail about what is blocking it from working? |
@metzc I'm going to work on it but not in next few days. If anyone wants to create a PR, it would be nice :) @stubailo An extended This way you get templates compiled to JS: // many of
document.createElement(/* ... */) instead of: <input *ngIf="!something" [(ngModel)]="bar" /> |
Sure, I guess I'm wondering why this repository has to be involved in that. Isn't compiling the code some other tool's problem? |
It has few requirements and if I remember correctly |
as @stubailo said there are requirements. This post has some useful hints: https://medium.com/@isaacplmann/making-your-angular-2-library-statically-analyzable-for-aot-e1c6f3ebedd5#.pbg52i3qt Part of the problem is also the apollo-client library where i created a seperate issue: apollographql/apollo-client#758 I tried to do some fixes myself and i found out that the ApolloModule.withClient(client) method does not work that way with AOT. I could make it to work by changing the module code to the way it was done by ng2-translate: https://github.com/ocombe/ng2-translate/blob/master/ng2-translate.ts (this stackoverflow post also seems to confirm the solution: https://stackoverflow.com/questions/39948342/making-aot-compatible-di) This would break the tutorial and i think also requires changes i have done to the apollo-client library (removing the default export), so a pull request now wouldn't make sense i assume. |
Instead of using constants/ApolloClient.ts ....
export const APOLLO_CLIENT = new ApolloClient({
networkInterface: NETWORK_INTERFACE
});
export function apolloClientFactory(): ApolloClient {
return APOLLO_CLIENT;
} modules/AppModule.ts @NgModule({
...
providers: [
...
{
provide: Angular2Apollo,
useFactory: apolloClientFactory
}
] |
DONE! 🚀 #124 |
And an example |
for some reason I could still not make your example work on ionic 2. I am using the correct versions of packages?
|
Sorry I have now solved it , I did not notice it should be
not
|
e.g. needed for Ionic 2 RC0
The text was updated successfully, but these errors were encountered: