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
0
votes
1 answer

Dynamically creating components - "ng build --prod" throws an error during package creation

I am building an angular 7 application and dynamically creating components (form controls) at runtime depending on data type. Following is an excerpt from my dynamically-loading-component.ts file this.componentRef.instance.form = this.form; const…
Deepak Agarwal
  • 458
  • 1
  • 4
  • 18
0
votes
0 answers

Dynamic import modules according to environment - AOT

By following this article I tried to dynamically import modules to my AppModule according to the environment I'm running (e.g. I only want StoreDevtoolsModule in dev, not in production). My approach was let devImports = [ …
João Ghignatti
  • 2,281
  • 1
  • 13
  • 25
0
votes
1 answer

angular aot project + jit

Is there an 'officcial' way in angular 7/8 to have a classic AOT app lazy load components BUT having those components not precompiled? My scenario is an enterprise app where users can 'design' html+ts forms on the fly. These forms are stored as…
user5328504
  • 734
  • 6
  • 21
0
votes
1 answer

Accessing window properties in an AoT-compiled Angular app

To prevent building our Angular-App multiple times for different environments, we tried to forgo injecting environment-specific variables (e.g. service endpoints) into our app with regular fileReplacements and instead load those environments from…
Leo
  • 115
  • 1
  • 7
0
votes
1 answer

Error in Angular aot build: Expression form not supported

I get some errors when building in order to enable Server Side Rendering. Here I get the errors: const lang = ( typeof localStorage!=='undefined' && localStorage.getItem("lang") ) ? localStorage.getItem("lang") : config.defaultLang; Errors: ERROR…
Vahid Najafi
  • 4,654
  • 11
  • 43
  • 88
0
votes
0 answers

Running AoT changes the layout

I've found something really fishy behavior in the project that I dont understand and I havent found any solution for why it behaves like this. It's an Angular application and we upgraded from ng5 to ng7, also upgraded bootsrap along the way. And…
Jedi Schmedi
  • 746
  • 10
  • 36
0
votes
1 answer

Angular: how to override a component template without writing a new component

I'm looking for a way to use my components replacing the standard templates with custom ones, but still keeping AOT compatibility. I know it can be done writing a new component which replaces the original template, but I'd like to provide some…
Davide Cavestro
  • 473
  • 5
  • 13
0
votes
1 answer

Angular 6 Importing Feature Module Fails -- Function calls are not supported in decorators

I'm new to Angular 6 having worked in AngularJS 1.x before. I'm currently trying to import a custom module into my main application and having an error that I think I'm misunderstanding. I've seen a couple of other SO posts realted to this, and I…
RoboBear
  • 5,434
  • 2
  • 33
  • 40
0
votes
1 answer

transform HTML string to Angular Components

let's say we do an API call and get some HTML DOM in a String. The content comes as HTML without angular, so I have first to transform it to Angular where I want and then compile it as angular. Example API response:
...some more html...

a…

0
votes
1 answer

Property 'section 1' does not exist on type 'FormGroup'. aot build

When I take aot build in angular I got an error Property 'section 1' does not exist on type 'FormGroup'. I had added
Anuj K.C.
  • 478
  • 3
  • 10
  • 25
0
votes
0 answers

Angular 7 ctor error with FormControlDirective only in AOT build

In upgrading from Angular 6 to 7 everything seemed fine except when I output to aot. I can successfully create a build with the cli and one of my lazy loaded modules works and other does not in that it gets a very weird exception. Putting a…
evanjmg
  • 3,465
  • 1
  • 14
  • 12
0
votes
1 answer

Error AOT building a custom component decorator - Angular 5

I've build a custom component decorator, as described here Inheritance of Angular 5 components with overriding the decorator properties. import { Component } from '@angular/core'; export function ExtendedComponent(extendedConfig: Component…
d9nny
  • 11
  • 5
0
votes
2 answers

Where to find AOT flag in Angular 6?

1) Where in Angular.io website documentation i can find that AOT is already enabled by default in Angular 6? 2)I have my cli based application of Angular 6. In which file can i find this flag so i can enable or disable it?
knowdotnet
  • 839
  • 1
  • 15
  • 29
0
votes
1 answer

Typescript map in angular with AOT

I am using typescript map (testMap: Map> = new Map>();) in my angular application and everything works if I run it using 'ng serve'. But if run it using 'ng serve --aot', maps are not working. I don't get…
user911
  • 1,509
  • 6
  • 26
  • 52
0
votes
1 answer

Can't load dynamic arguments in an Angular module forRoot import while running with --aot flag

I'm trying to get my code to compile during --aot flag, but it fails where I try to load environment configuration into my logging service that I import in my app.module.ts file. I have code looking like this that runs fine with "ng serve" This is…
Sam
  • 418
  • 2
  • 6
  • 18