Questions tagged [angular2-aot]

Use angular2-aot for questions related to the Angular2 ahead-of-time compiler, which allows developers to deploy pre-compiled JavaScript code and HTML5 markup to the browser rather than TypeScript and Angular templates.

References

431 questions
130
votes
10 answers

Property 'X' is private and only accessible within class 'xyzComponent'

I'm trying to build angular2 application for production for that I'm following this blog. After my ngc successful compilation when the tsc compilation takes place it generates below error shown in the image: After searching for a while I found this…
Sumit Khanduri
  • 3,619
  • 7
  • 30
  • 40
53
votes
1 answer

Pass config data using forRoot

I am trying to pass config data into a custom library in Angular. In the users application, they will pass some config data to my library using forRoot // Import custom library import { SampleModule, SampleService } from 'custom-library'; ... //…
Michael Doye
  • 8,063
  • 5
  • 40
  • 56
53
votes
6 answers

Can angular-cli remove unused css?

so far the smallest bundle I can create with angular cli is by running ng build --aot true -prod I was wondering if the build process also removes unused css classes e.g. from bootstrap? If not how can I add libraries like purifycss to it? EDIT…
Han Che
  • 8,239
  • 19
  • 70
  • 116
29
votes
9 answers

Using Rollup for Angular 2's AoT compiler and importing Moment.js

I'm trying to follow the official AoT guide for Angular 2, and I'm using Moment.js in my application. Moment.js is on my packages.json file, and I'm using version 2.15.0. I've been importing it like this so far: import * as moment from…
Vitor Machado
  • 405
  • 4
  • 9
21
votes
2 answers

Angular 2 Ahead-of-Time compiler: must I make all class properties public?

Angular 2 rc 6, typescript 2, node 4.5.0, npm 2.15.9 on Windows 7 I'm trying to move from Just-in-Time to Ahead-of-Time compilation and I'm relying on these resources: Angular 2 - Ahead-of-time compilation how…
BeetleJuice
  • 39,516
  • 19
  • 105
  • 165
18
votes
2 answers

How to handle angular2 lazy loading route failure

I'm using angular 2 lazy routing. Client is bundled with webpack2 using AOT and angular-router-loader to lazy load children. Everything works as expected when the browser is connected, that is I can successfully navigate the router to the lazy…
angeor
  • 181
  • 1
  • 6
14
votes
2 answers

Get the value of --locale on runtime for an AOT compiled Angular App

I have an multilanguale app which is compiled with --aot in each language, for instance for German: ng build --aot --env=prod --prod --build-optimizer --i18nFile=src/locale/DARI_messages_de_DE.xlf --i18nFormat=xlf --locale=de --missingTranslation…
Thomas
  • 1,058
  • 8
  • 15
13
votes
1 answer

Angular AOT and lazy loading. TypeError: System.import is not a function

I am using Angular 4. After AOT and run rollup in lazy module appears this error: Error: Uncaught (in promise):TypeError: System.import is not a function My project works fine in JIT but in AOT I could not redirect to lazy routes. I could not…
Mohsen
  • 185
  • 8
12
votes
3 answers

Function calls are not supported in decorators while ng build --prod (AOT)

Type of Issue: Bug / Question Description I'm using ng-packagr lib to compile my library to js. I've compiled everything without any problems, but when I'll want to consume my library with ng build --prod (AOT enabled), I'm getting error: ERROR in…
12
votes
11 answers

Angular AOT Build: Internal error: unknown identifier undefined

My current Angular 2 project started before Angular supported the AOT feature. Now, I’m trying to get it to work. I'm receiving the following error and I've no clue what this means and where I can start to debug the issue: ERROR in Error: Internal…
im4ever
  • 469
  • 1
  • 4
  • 14
12
votes
2 answers

How to run angular cli ng test with production build settings and AOT enabled

Is there a way to run the angular cli tests with the command ng test that tells the underlining compiler to use the ng build --prod settings? I ask because here are often aot compilation errors encountered with ng build --prod that do not occur with…
kampsj
  • 3,139
  • 5
  • 34
  • 56
11
votes
1 answer

Is Babel being used as compiler (AOT or JIT) in angular 5

Do we need Babel in an Angular 5 application? What AOT or JIT is being used internally to compile?
RK6
  • 424
  • 1
  • 5
  • 23
11
votes
1 answer

Angular2 : Dynamic component creation : AOT Compilation

Below is my initial code to create dynamic module: protected createComponentModule(componentType: any) { @NgModule({ imports: [ ComponentModule ], declarations: [ componentType ], }) …
11
votes
4 answers

Angular2 "No provider for t!" and Uncaught (in promise): Error: DI Error

I've build a app in Angular 2, and have encountered a issue. I have used angular CLI to create my application, I have created my components and services using Angular CLI and I use "ng serve" to run the application locally and everything works fine.…
Prasanna J
  • 195
  • 1
  • 3
  • 7
9
votes
5 answers

ERROR in Error during template compile of 'AppModule'

Trying to build an Angular 6 app. I am getting the following error when using --prod ERROR in Error during template compile of 'AppModule' Expression form not supported in 'reducers' 'reducers' contains the error at…
Harry Blue
  • 4,202
  • 10
  • 39
  • 78
1
2 3
28 29