Current behavior
Readme explains bootstrapping for Ionic Beta
Expected/desired behavior
Readme explains bootstrapping for Ionic RC
Edit: Trying to put TranslateModule.forRoot() into imports in _app.module.ts_ will kill the _ngc_.
Yes, it's definitely on my todo list :)
Any quick tips on how to get it to work with Ionic RC.0?
I suppose it should work just like the regular documentation for non ionic apps, just import the module and call forRoot() (with or without parameters, depending on what you need, check for the readme for that)
Unfortunately it doesn't work. I get
ngc error: Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in xxx/.tmp/app/app.module.ts, resolving symbol AppModule in xxx/.tmp/app/app.module.ts
Using
imports: [
IonicModule.forRoot(MyApp),
HttpModule,
TranslateModule.forRoot()
],
Hi! That's #218 .
Ah, so it is. Thank you.
On my side it writes:
[16:58:58] Error: Module /node_modules/ng2-translate/ng2-translate.js does not export TranslateLoader (imported by /.tmp/app/app.module.js)
I did the following in app.model.ts:
import { TranslateModule, TranslateLoader, TranslateStaticLoader } from 'ng2-translate/ng2-translate';
imports: [
BrowserModule,
HttpModule,
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (http: Http) => new TranslateStaticLoader(http, '/assets/i18n', '.json'),
deps: [Http]
}),
IonicModule.forRoot(MyApp)
],
exports: [BrowserModule, HttpModule, TranslateModule],
TranslateLoader and TranslateStaticLoader can be imported from 'ng2-translate/src/translate.service', but calling TranslateModule.forRoot() will cause the build process to fail.
dev mode works fine if we include {TranslateLoader , TranslateStaticLoader, TranslateService } from 'ng2-translate/src/translate.service',
"ionic build" fails
ngc error: Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 30:23 in the original .ts file), resolving symbol AppModule in C:/Users/dsc/dev/23_angular__rhenus__information/.tmp/app/app.module.ts
at simplifyInContext (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\static_reflector.js:469:23)
at StaticReflector.simplify (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\static_reflector.js:472:22)
at StaticReflector.annotations (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\static_reflector.js:61:36)
at _loop_1 (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\codegen.js:53:54)
at CodeGenerator.readFileMetadata (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\codegen.js:66:13)
at C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\codegen.js:100:74
at Array.map (native)
at CodeGenerator.codegen (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\codegen.js:100:35)
at codegen (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\compiler-cli\src\main.js:7:81)
at Object.main (C:\Users\dsc\dev\23_angular__rhenus__information\node_modules\@angular\tsc-wrapped\src\main.js:30:16)
Same for me.
Error: Module node_modules/ng2-translate/ng2-translate.js does not export TranslateLoader (imported by /home/SideMenu/.tmp/app/app.module.js)
https://github.com/ocombe/ng2-translate/issues/218 has some sort of solution
Thanks for the quick fix!
Be careful, for ionic the configuration should be :
useFactory: (http: Http) => new TranslateStaticLoader(http, 'assets/i18n', '.json'),
instead of
useFactory: (http: Http) => new TranslateStaticLoader(http, '/assets/i18n', '.json'),
(mind the slash before assets)
Most helpful comment
On my side it writes:
[16:58:58] Error: Module /node_modules/ng2-translate/ng2-translate.js does not export TranslateLoader (imported by /.tmp/app/app.module.js)
I did the following in app.model.ts: