Skip to content
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

Update Ionic 2 example to RC.0 #248

Closed
NoNameProvided opened this issue Sep 28, 2016 · 13 comments · Fixed by #252
Closed

Update Ionic 2 example to RC.0 #248

NoNameProvided opened this issue Sep 28, 2016 · 13 comments · Fixed by #252

Comments

@NoNameProvided
Copy link
Contributor

NoNameProvided commented Sep 28, 2016

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.

@ocombe
Copy link
Member

ocombe commented Sep 29, 2016

Yes, it's definitely on my todo list :)

@DreamitMauri
Copy link

Any quick tips on how to get it to work with Ionic RC.0?

@ocombe
Copy link
Member

ocombe commented Sep 29, 2016

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)

@DreamitMauri
Copy link

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() ],

@chiccorusso
Copy link

Hi! That's #218 .

@DreamitMauri
Copy link

Ah, so it is. Thank you.

@danielgolub
Copy link

danielgolub commented Sep 29, 2016

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],

@membersheep
Copy link

TranslateLoader and TranslateStaticLoader can be imported from 'ng2-translate/src/translate.service', but calling TranslateModule.forRoot() will cause the build process to fail.

@derksacklowski
Copy link

derksacklowski commented Sep 30, 2016

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)

@jafaripur
Copy link

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)

@derksacklowski
Copy link

#218 has some sort of solution

ocombe added a commit that referenced this issue Sep 30, 2016
feat(npm): generate AoT files & distribute ES modules + UMD bundle

BREAKING CHANGE: the files are now available as ES modules or UMD bundle and no longer commonjs files

Fixes #218
Fixes #248 
Closes #242
ocombe added a commit that referenced this issue Sep 30, 2016
BREAKING CHANGE: the files are now available as ES modules or UMD bundle and no longer commonjs files

Fixes #218
Fixes #248
Closes #242
@NoNameProvided
Copy link
Contributor Author

Thanks for the quick fix!

@Eagleseb
Copy link

Eagleseb commented Oct 1, 2016

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants