You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: I am trying to use Angular2 AoT for my Angular2 application, but since I have static providers to pass some values from server to Angular2, ngc shows some errors. My problem is how to get the ngFactory files created using ngc.
Details: I am using the cookbook guide, and running "node_modules/.bin/ngc" -p tsconfig-aot.json shows me the below error:
Error: Cannot determine the module for component AppComponent!
at F:\workspace\node\my-project\node_modules\@angular\compiler\bundles\compiler.umd.js:12839:25
at Array.map (native)
at OfflineCompiler.compile (F:\workspace\node\my-project\node_modules\@angular\compiler\bundles\compiler.umd.js:12835:31)
at F:\workspace\node\my-project\node_modules\@angular\compiler-cli\src\codegen.js:108:18
at Array.map (native)
at CodeGenerator.codegen (F:\workspace\node\my-project\node_modules\@angular\compiler-cli\src\codegen.js:106:38)
at codegen (F:\workspace\node\my-project\node_modules\@angular\compiler-cli\src\main.js:7:81)
at Object.main (F:\workspace\node\my-project\node_modules\@angular\tsc-wrapped\src\main.js:30:16)
at Object.<anonymous> (F:\workspace\node\my-project\node_modules\@angular\compiler-cli\src\main.js:14:9)
at Module._compile (module.js:541:32)
Compilation failed
I verified that if I remove code for static provider, that I used for passing data from servver to Angular2, i.e. createMainModule() in app.module.ts, and so on, then ngc works fine.
I am using SystemJS as the module loader.
I have posted the same on stackoverflow incase there is already a technique I do not know about, but it seems that is not the case and passing data from server to client (with the method I have used) and AoT is not possible.
The method I have used to pass data from server to client is exactly used as explained in the official angular 2 docs, saying that, AoT should support it.
The text was updated successfully, but these errors were encountered:
OS?
Versions.
Summary: I am trying to use Angular2 AoT for my Angular2 application, but since I have static providers to pass some values from server to Angular2,
ngc
shows some errors. My problem is how to get thengFactory
files created usingngc
.Details: I am using the cookbook guide, and running
"node_modules/.bin/ngc" -p tsconfig-aot.json
shows me the below error:tsconfig-aot.json:
package.json:
index.pug:
main.ts:
app.module.ts:
app.component.ts:
Notes:
createMainModule()
in app.module.ts, and so on, thenngc
works fine.The text was updated successfully, but these errors were encountered: