Questions tagged [angular-aot]

A AOT-Compiler (Ahead of time) compiles the source code before the code is executed. Unlike the JIT-Compiler (Just in time) which compiles right when the code is executed.

The Angular Ahead-of-Time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase before the browser downloads and runs that code.

This guide explains how to build with the AOT compiler using different compiler options and how to write Angular metadata that AOT can compile.

To find more information :

176 questions
5
votes
1 answer

AOT build files size is larger than normal build

I am working on a angular 7 app which works fine except loading issues, on research I found that I should be using AOT build instead of JIT or normal build, I was not able to make aot build because of huge application size, it was returning heap our…
Vikram
  • 3,171
  • 7
  • 37
  • 67
5
votes
0 answers

Angular 4 AOT + dynamic url tree

I want to dynamically create a URL tree and use it in Angular's router instead of "magic" strings. I have these classes: export abstract class UrlNode { protected parentUrl?: string; protected abstract shortUrl: string; …
E. Efimov
  • 443
  • 1
  • 5
  • 10
5
votes
0 answers

AOT in angular 5 without using CLI

Before Angular 5 release I could configure AOT by following official doc https://angular.io/guide/aot-compiler I understand that official documentation switched the focus to CLI. Is there any structured guide about Angular 5 AOT without using CLI?…
armache
  • 596
  • 5
  • 22
5
votes
1 answer

Angular - useFactory - Error function calls are not supported. Consider replacing the function or lambda with a reference to an exported function

I use Angular AOT compiler version 4.1.3 I have a component library that exports a factory method that is then used to provide a service: export function libServiceFactory(itemId: string) { return (http: Http): LibService => { return new…
nest
  • 1,385
  • 1
  • 15
  • 34
4
votes
1 answer

Nativescript app is not building when using --env.aot flag

I'm facing a weird issue when I build my NS app in AOT. I'm running the command tns build android --bundle --release --env.aot I'm getting below error. : 'StackLayout' is not a known element: 1. If 'StackLayout' is an…
4
votes
1 answer

(Angular / AOT) - Angularfire2 'initializeApp()' not loading the correct config properties

We are developing an Ionic hybrid app that uses Firebase as its backend. For it, we are using the npm package angularfire2. We have two databases, one for development and another one for production, so we want to swap them depending on the state of…
4
votes
0 answers

Angular 5 / AoT / Webpack / Code splitting issues

I am encountering a couple issues wrt getting AoT working in Angular 5 using Webpack. The Webpack AoT build completes without errors. 1) Code splitting due to lazily loaded modules is not happening when using @ngtools/webpack AngularCompilerPlugin.…
user3481798
  • 247
  • 2
  • 11
4
votes
3 answers

Angular 2 i18n message with HTML tag inside

Im trying to translate my app using the i18n official implementation of angular 2: https://angular.io/guide/i18n and im trying to translate some message with HTML inside (font awesome icons lets say). For example this:
3
votes
2 answers

Angular 5 AOT compilation failed

I have an Angular 5 app that works without problems when I run it in test mode, that is, when I run the application locally using the ng serve command. However, when I deploy the application in production mode, that is, through the command ng build…
AlejoDev
  • 4,345
  • 9
  • 36
  • 67
3
votes
2 answers

Angular route 'data' is empty in ActivatedRoute.snapshot when AoT is enabled

I have a few routes in my Angular 7 app that have a data property, used for different purposes - retrieved from activatedRoute.snapshot.data. The issue I'm having is that everything works as expected in development (JIT compiler) but once I move to…
Luca
  • 9,259
  • 5
  • 46
  • 59
3
votes
1 answer

AOT runtime error with AWS Amplify and Angular 7 - API is not defined

I have set up AWS Amplify in an Angular 7 project using the API module for GraphQL capabilities. All seems to work when served using ng serve. If however if I use AOT compilation - e.g. For a production build then I receive no compilation errors but…
3
votes
1 answer

Why Angular AoT don't supports function expressions in decorators?

Angular AoT compiler throw an error if you try to made a call in a decorator. consider following code: export function factoryBuilder(config: MyConfig) { return function customFactory() { return new MyService(config); …
ezain
  • 1,445
  • 1
  • 16
  • 32
3
votes
0 answers

Angular 6 - AOT compilation on library to be used as lazily loaded plugin in the main application

I am working on a plugin-based application done in Angular 6. I have 2 projects, a main project and a lib project where i develop the plugins. The plugins get builded with ng build --prod into UMD and then loaded using SystemJs into the main app,…
IvanSt
  • 360
  • 4
  • 17
3
votes
0 answers

Is there any way to preseve type in angular templates when using as keyword?

Angular can typecheck your templates in AOT and throw errors at compilation phase. Unfortunately this doesn't seem to work when using as keyword, for example in ngIf: *ngIf="typedVariable as newVariable" or in more common case,…
dunqan
  • 974
  • 7
  • 12
3
votes
0 answers

Angular 6 - Error on production build with Boolean and [ngClass]

I have this variable to my component showMenu: Boolean = false; and I'm using this on my html file
Michalis
  • 6,686
  • 13
  • 52
  • 78
1
2
3
11 12