angular2 upgrade - Getting a "Can't resolve all parameters" error when setting up a hybrid AngularJS / Angular app -
i want upgrade traditional angular js app , have been following documentation on angular.io setup hybrid app.
now bootstrapping process in app.ts looks like:
import { platformbrowserdynamic } '@angular/platform-browser-dynamic'; import { appmodule } "./app.module"; platformbrowserdynamic().bootstrapmodule(appmodule);
my new app.module.ts looks like:
import { ngmodule } '@angular/core'; import { browsermodule } '@angular/platform-browser'; import { upgrademodule } '@angular/upgrade/static'; @ngmodule({ imports: [ browsermodule, upgrademodule ]}) export class appmodule { constructor(private upgrade: upgrademodule) { } ngdobootstrap() { this.upgrade.bootstrap(document.body, ['myapp'], { strictdi: true }); } }
however, when run application following error:
compiler.es5.js:1503 uncaught error: can't resolve parameters appmodule: (?). @ syntaxerror (compiler.es5.js:1503) @ compilemetadataresolver._getdependenciesmetadata (compiler.es5.js:14780) @ compilemetadataresolver._gettypemetadata (compiler.es5.js:14648) @ compilemetadataresolver.getngmodulemetadata (compiler.es5.js:14489) @ jitcompiler._loadmodules (compiler.es5.js:25561) @ jitcompiler._compilemoduleandcomponents (compiler.es5.js:25520) @ jitcompiler.compilemoduleasync (compiler.es5.js:25482) @ platformref_._bootstrapmodulewithzone (core.es5.js:4786) @ platformref_.bootstrapmodule (core.es5.js:4772) @ object.map../af (app.ts:487)
it seems me angular unable find upgrademodule in order resolve dependencies in appmodule.
my question is: missing bootstrap process in order fix this?
(note: may or may not relevant using webpack module loader.)
i got working , created example github repository showing basic solution using webpack bundle hybrid app:
Comments
Post a Comment