angular9

Angular 9 Project is not working in production environment

蓝咒 提交于 2020-08-22 05:06:26
问题 I have migrated our Angular hybrid project from 8 to 9. The migration went smooth and ng build / ng serve works well like it did before. The real problem, where I don't know how to start working on it, is after I build the app for production (ng build --prod). The landing page of the project is completely blank, no JS errors, no console warnings. It looks like the AppModule is not loaded? The only change we had to do was related to main.aot.ts file, we removed that file as it's no longer

Job name “..getProjectMetadata” does not exist

独自空忆成欢 提交于 2020-08-20 18:07:16
问题 I updated my angular to v9 and when I try to go back in v8, I receive this error. I have already tried the following: uninstall -global angular/cli uninstall angular/cli go back to my last package.json delete node_module folder delete repo This error continues to show. My stacktrace is : An unhandled exception occurred: Job name "..getProjectMetadata" does not exist. See angular-errors.log for further details. angular-errors.log : [error] Error: Job name "..getProjectMetadata" does not exist.

Angular: parsing JSON variables to SCSS causes unit tests(karma) to fail

半腔热情 提交于 2020-08-10 19:31:09
问题 In my angular app, I am trying to use data from a json file into scss and I followed the solution provided here by Christos Lytara Angular: How to parse JSON variables into SCSS Error Screenshot I have tried this for my application and it works fine! But my unit test cases are failing. I am getting this error. Can someone please advise. ERROR in ./src/app/components/get-to-know/get-to-know.component.scss Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Invalid CSS

Angular: parsing JSON variables to SCSS causes unit tests(karma) to fail

假如想象 提交于 2020-08-10 19:30:01
问题 In my angular app, I am trying to use data from a json file into scss and I followed the solution provided here by Christos Lytara Angular: How to parse JSON variables into SCSS Error Screenshot I have tried this for my application and it works fine! But my unit test cases are failing. I am getting this error. Can someone please advise. ERROR in ./src/app/components/get-to-know/get-to-know.component.scss Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Invalid CSS

Cannot add property “X”, object is not extensible angular 9

南楼画角 提交于 2020-08-08 01:13:34
问题 I have encountered this issue on many places after some days of updating from Angular 8 to Angular 9. Earlier it was working fine. Can anyone help me what's the problem. Example code below list.reduce((acc, curr) => { const obj = {}; obj['x'] = curr['Y']; }); 回答1: I refer change list of Ngrx version 8 to 9 and migration guideline here https://ngrx.io/guide/migration/v9 As I found there is a special change related to immutability with angular 9. They have defined Action, state and

Cannot add property “X”, object is not extensible angular 9

霸气de小男生 提交于 2020-08-08 01:11:28
问题 I have encountered this issue on many places after some days of updating from Angular 8 to Angular 9. Earlier it was working fine. Can anyone help me what's the problem. Example code below list.reduce((acc, curr) => { const obj = {}; obj['x'] = curr['Y']; }); 回答1: I refer change list of Ngrx version 8 to 9 and migration guideline here https://ngrx.io/guide/migration/v9 As I found there is a special change related to immutability with angular 9. They have defined Action, state and

Can't bind to 'ngForOf' since it isn't a known property of 'tr' in Angular 9

纵饮孤独 提交于 2020-07-19 23:04:52
问题 I'm having a problem that ngFor isn't working in my app. I splited my app into separate modules and included import { CommonModule } from '@angular/common'; into my child module and import { BrowserModule } from '@angular/platform-browser'; into my app.modules.ts file, but I still get the error following error. Can't bind to 'ngForOf' since it isn't a known property of 'tr'. I have tried looking into other questions but all those said to just include CommonModule, which I am. These are my

Could not load the config file in service - vendor js 65401

随声附和 提交于 2020-07-10 10:26:26
问题 It works fine in injecting into components. problem occurs in service injection. I am using runtime configuration for end points.it works in components.i can able to change in runtime but throws an error when injecting in other services global export class AppConfigService { static settings: IAppConfig; constructor(private http: HttpClient) {} load() { const jsonFile = `../assets/config/config.json`; return new Promise<void>((resolve, reject) => { this.http.get(jsonFile).toPromise().then(

Angular custom clickaway listener is triggered if a child component is removed using *ngIf

大憨熊 提交于 2020-07-09 11:58:28
问题 I have a clickaway listener as a directive that uses @HostListener put on App.component.ts @Component({ selector: "app-root", templateUrl: "./app.component.html", styleUrls: ["./app.component.css"], }) export class AppComponent { constructor(private clickaway: ClickawayService) {} @HostListener("document:click", ["$event"]) documentClick(event: any): void { this.clickaway.target.next(event.target); } } @Directive({ selector: "[clickaway]", }) export class ClickawayDirective implements OnInit,

Angular 9 Ivy - Generic type 'ɵɵFactoryDef' requires 2 type argument(s)

和自甴很熟 提交于 2020-07-06 05:31:16
问题 Looks like Angular Ivy not ready yet. I'm trying to build my project using ivy which is the main idea for Angular 9. Many of libraries are not compatible with this feature, one of these library is @angular/flex-layout . Material and service-worker have the same problem as well. After using ng build --prod --aot -c=production script to build my project I got: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/@angular/flex-layout/core/typings/media-trigger/media-trigger.d.ts:71:18 - error TS2314: