angular2-aot

Angular 2 AOT - Can't resolve $$_gendir…ngfactory

倾然丶 夕夏残阳落幕 提交于 2019-12-24 09:54:06
问题 https://github.com/stefankendall/broken-aot I'm trying to setup a simple AOT angular 2 build with webpack and gulp. In my minimal example I've created, I have the following: ./src/app/components - components used by the main application, a separate ngmodule ./src/app/examples - the main application ERROR in ./src/index.ts Module not found: Error: Can't resolve './../$$_gendir/src/app/examples/app.module.ts.ngfactory' in '/Users/username/workpath/projectname/src' @ ./src/index.ts 8:32-98 Based

Angular condition in type provider with AOT

醉酒当歌 提交于 2019-12-23 19:15:09
问题 I have an Angular project which I compile with AOT. I want to be able to register ClassProvider that is resolved dynamically according to configuration. Simplified code I use is this: const isMock = Math.random() > 0.5; @NgModule({ // ... providers: [ { provide: MyServiceBase, useClass: (isMock) ? MyServiceMock : MyService }, ], bootstrap: [AppComponent] }) export class AppModule { } The problem is when I compile this with AOT I always get the same service. I would expect to get different

Angular2 AoT - Expression form not supported

这一生的挚爱 提交于 2019-12-23 12:27:26
问题 I'm trying to use ngc to compile angular 2.4.4: Error: Error encountered resolving symbol values statically. Expression form not supported (position 52:9 in the original .ts file), resolving symbol DEFAULT_APP_STATE in... It looks like it is complaining about how i'm exporting a constant for @ngrx/store. I tried changing the constant into an exported function... as well as all of the properties. Previously: export const DEFAULT_APP_STATE = { Offline: DEFAULT_APP_OFFLINE_STATE, Initialized:

Angular AOT failing at compilation (something with angular/compiler-cli)

蓝咒 提交于 2019-12-22 14:41:48
问题 After going through the AOT tutorial on the Docs page, I am trying to compile angular 2 AOT and am getting the following error "node_modules/.bin/ngc" -p tsconfig-aot.json TypeError: compiler.AnimationParser is not a constructor at Function.CodeGenerator.create (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\codegen.js:108:400) at codegen (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:7:36) at Object.main (C:\Projects\NeilKellyClient4\node

Angular AOT failing at compilation (something with angular/compiler-cli)

╄→尐↘猪︶ㄣ 提交于 2019-12-22 14:40:25
问题 After going through the AOT tutorial on the Docs page, I am trying to compile angular 2 AOT and am getting the following error "node_modules/.bin/ngc" -p tsconfig-aot.json TypeError: compiler.AnimationParser is not a constructor at Function.CodeGenerator.create (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\codegen.js:108:400) at codegen (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:7:36) at Object.main (C:\Projects\NeilKellyClient4\node

Angular 2, @ngtools/webpack, AOT

荒凉一梦 提交于 2019-12-22 11:24:51
问题 I'm trying to use AOT in Angular 2 using webpack and @ngtools/webpack. I don't have any error with the compilation, but when I open the site on the browser I get a console error: No NgModule metadata found for 'AppModule' My AotPlugin on webpack configuration is this: new AotPlugin({ tsConfigPath: 'tsconfig.json', entryModule: helpers.root('src/app/app.module.ts#AppModule') }) My app.module.ts is: @NgModule({ bootstrap: [ App ], imports: [ // import Angular's modules BrowserModule,

How to provide an alternate i18n language link in Angular with aot compiling?

China☆狼群 提交于 2019-12-22 09:53:28
问题 I am currently working on i18n of my Angular app. I use AOT compiling with xlf files to create pre-compiled apps as described here. In the build, I provide a language specific base href (using the --base-href parm). For example, this means, I end up with two language specific apps using the following url paths: /app_path/en/... /app_path/de/... Now I want to provide a link to the respective alternate language within my app by replacing for example en by de in the active url. I used the Router

Angular 2 Bootstrapping Options - AOT vs JIT

馋奶兔 提交于 2019-12-22 04:43:24
问题 Just kick started with Angular 2. What are the various Bootstrapping options in angular 2? Why is that when I make a change and refresh the index.html takes little time to retrieve the HTML markups? Differences between them 回答1: There are two options Dynamic bootstrapping compiler used JIT (Just in Time). dynamically compiles the ts files in the browser. this is the reason the index.html takes little time to retrieve the markups. main.ts contains the following import { platformBrowserDynamic

Angular 2 Bootstrapping Options - AOT vs JIT

夙愿已清 提交于 2019-12-22 04:43:04
问题 Just kick started with Angular 2. What are the various Bootstrapping options in angular 2? Why is that when I make a change and refresh the index.html takes little time to retrieve the HTML markups? Differences between them 回答1: There are two options Dynamic bootstrapping compiler used JIT (Just in Time). dynamically compiles the ts files in the browser. this is the reason the index.html takes little time to retrieve the markups. main.ts contains the following import { platformBrowserDynamic

How to debug angular 2 aot failures

廉价感情. 提交于 2019-12-19 07:10:29
问题 I have an angular 2 app generated by ng cli. - When I run ng build (or) ng build --prod --aot=false and serve up the page things just work fine. - But when I try to enable aot by running ng serve --aot=true and serve up, the page breaks with multiple DI errors like below Very hard to debug. Any idea on how to debug these issues? EXCEPTION: No provider for Options! error_handler.js:59 ORIGINAL STACKTRACE: ErrorHandler.handleError @ error_handler.js:59 (anonymous) @ application_ref.js:272