angular-compiler

Configuring angular production files after build

放肆的年华 提交于 2021-02-11 13:50:22
问题 I have an angular 9 project which is part of an application suite installer [Wix installer]. One of the settings used by the angular app is the address of API which it fetches its data from some configurable address. I know that I can have many angular environment files and simply use commands such as the followings: environment.env1.ts export const environment = { production: true, apiAddress: "http://apiAddress1/api/", }; ng build --prod --configuration=env1 or environment.env2.ts export

Angular 9 - NGCC fails with an unhandled exception

浪子不回头ぞ 提交于 2020-08-21 06:12:34
问题 Buidling the application after having upgraded dependcies to Angular 9 (and having performed necessary code changes) throws an error: Compiling @angular/animations : es2015 as esm2015 Compiling @angular/animations : es2015 as esm2015 Compiling @angular/core : es2015 as esm2015 Compiling @angular/core : es2015 as esm2015 Compiling @angular/core : es2015 as esm2015 Error : Error on worker #5: TypeError: Cannot read property 'fileName' of null It then goes on to throw the below error: Compiling

How to compile runtime-generated Angular8 code?

风格不统一 提交于 2020-06-08 12:40:37
问题 I'm creating Angular code at runtime, in particular, I use a SVG library in order to create a vector graphic that contains Angular code directives like (click)='myMethod()' , which, in turn, call methods I've statically defined in the SVG-enclosing component. Being generated at runtime I need to compile the created template and add it to a component. I implemented such code back then with Angular 3 with the help of this post which was quite cumbersome. I tried to the copy the old code in an

How to compile runtime-generated Angular8 code?

白昼怎懂夜的黑 提交于 2020-06-08 12:40:28
问题 I'm creating Angular code at runtime, in particular, I use a SVG library in order to create a vector graphic that contains Angular code directives like (click)='myMethod()' , which, in turn, call methods I've statically defined in the SVG-enclosing component. Being generated at runtime I need to compile the created template and add it to a component. I implemented such code back then with Angular 3 with the help of this post which was quite cumbersome. I tried to the copy the old code in an

AOT compiler - include lazy loaded external module

两盒软妹~` 提交于 2020-01-12 05:43:05
问题 I am trying to include external module (hosted in git/npm repository) as lazy-loaded module in my Angular application. I am compiling my external module with ngc compiler: node_modules/.bin/ngc -p tsconfig-aot.json This is how my compiler config looks: { "extends": "./tsconfig.json", "compilerOptions": { "baseUrl": "src", "declaration": true, "outDir": "./release/src" }, "files": [ "./src/index.ts" ], "angularCompilerOptions": { "genDir": "release", "skipTemplateCodegen": true, "entryModule":

_lazy_route_resource lazy namespace object

北战南征 提交于 2020-01-02 01:31:07
问题 I'm using angular compiler: const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin; With these compiler options: "angularCompilerOptions": { "genDir": "./build/compiled", "outDir": "./build/compiled", "skipMetadataEmit": true, "debug": true}, Relevant part of my package.json is: "@ngtools/webpack": "^6.0.0", "@angular/router": "^5.2.0", "webpack": "4.8.3", "webpack-cli": "2.1.4", And my angularCompilerPlugin config is: new AngularCompilerPlugin({ tsConfigPath: 'path

Can I make the Angular Compiler throw an error when a non-existing property is bound?

馋奶兔 提交于 2019-12-24 01:58:19
问题 Consider the following template: <p>Hello, {{ name }}</p> <button (click)="doLogin()">Login</button> together with this TS-Class: @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent {} Neither name nor doLogin() exist. Still it compiles and runs without error. Only when I try to click the button, I get the error message doLogin is not a function in the browser's console. I do know, that this behaviour (errors

Dynamically load Angular 4 template using existing component and module

丶灬走出姿态 提交于 2019-12-08 05:57:53
问题 I am attempting to load an HTML template received from the backend. This template includes custom pipes and should be populated with data that is received from a different web service. Here is an example of how it is currently set up. -app -/person --person.module.ts --person.service.ts --/person-info ---person-info.component.ts Ideally, I would like to receive the template and set it up within the person-info.component.ts since I have all of the necessary code for that HTML in that component