angular7

@NgModule.entryComponents and Components created dynamically

蓝咒 提交于 2019-12-13 23:29:53
问题 I am opening a Modal in two different ways Stackblitz Example: Calling a method in a component which calls the Modal Service: <button (click)="openModal()">Open Modal</button> export class AppComponent { constructor(private modalService: ModalService) { } openModal() { this.modalService.open(HelloComponent); } } The Modal service creates the component dynamically. Using a directive that then calls the ModalService: <button [modal]="'HelloComponent'">Open Modal</button> @Directive({ selector:

primeng p-table exportCSV() function not working?

[亡魂溺海] 提交于 2019-12-13 20:33:09
问题 I am using new PrimengV7 p-table I want export the table, So my code is <p-header> <div class="pull-right" *ngIf="collapsed"> <a href="javascript:void(0)" (click)="dt.exportCSV()" class="icon-export" title="Export"></a> </div> </p-header> <p-table class="ui-datatable" #dt [value]="rmanReconSosrcToBkingsRepList" selectionMode="single" [(selection)]="selectedEmployees" (onRowSelect)="onRowSelect($event)" (onLazyLoad)="getRmanReconSosrcToBkingsRep($event)" [lazy]="true" [paginator]="true" [rows]

Invert “checked” value of a mat-checkbox

你说的曾经没有我的故事 提交于 2019-12-13 20:24:29
问题 When a Angular Material mat-checkbox (https://material.angular.io/components/checkbox/overview) is checked it has the value "true". When it is unchecked it has the value "false". Is there a way to turn this behaviour around? I need just the opposite. A checked checkbox should serialize to "false" and a unchecked one should serialize to "true" when calling this.filterFormGroup.getRawValue() . I was hoping that there is something like this: <mat-checkbox [myCustomCheckedValue]="false"

How to resolve Angular 7 “Error trying to diff … Only arrays and iterables are allowed” error?

只愿长相守 提交于 2019-12-13 19:12:51
问题 I'm using Angular 7. I'm having trouble rendering data stored in my model. I have this in my src/app/app.component.ts file @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { currencies: Currency[] = []; title = 'app'; apiStatus: string; constructor(private _currencySrv: CurrencyService) { } ngOnInit() { this._currencySrv.index().subscribe(currencies => { this.currencies = currencies; }); }

How to access Resolver Data in ngrx/effects? (v7)

自作多情 提交于 2019-12-13 04:25:20
问题 I have api calls in the component which is time taking , so i have implemented resolver. I want the resolver data to be present in the store , for later use. I have implemented ngrx/store, ngrx/effects and ngrx/router-store. Current state in component getting data directly from resolver data in component (route is of type ActivatedRoute) Desired state To keep the resolver data in store, I need to access resolver data in effects. So i can simply dispatch action in component and subscribe the

Ionic 4 Angular 7 - HTTPClient.post() is not returning any response

夙愿已清 提交于 2019-12-13 03:46:33
问题 I am trying to do a HTTPClient.post() to a web service but I am receiving no response. I tried executing the service call through post man and I am receiving a response. I have tried enabling and disabling CORS but there is no difference. Below is my service.ts authentication.service.ts import { Platform } from '@ionic/angular'; import { Injectable } from '@angular/core'; import { Storage } from '@ionic/storage'; import { BehaviorSubject } from 'rxjs'; import { HttpClient, HttpHeaders,

Connection refused: localhost:4200 favicon.ico 502 in angular 7

时间秒杀一切 提交于 2019-12-13 03:20:40
问题 I have create an angular project via ng new project_name --style=scss and then try to run via ng serve but getting error removed and reinstalled the node_modules but all in vain. Every time getting this error, please guide what to do!!! UPDATE 1 Why I am not able to run Angular application on localhost (running on 192.168.X.X:4200) in my office pc but the same project I can run on localhost at my home UPDATE 2 in hosts file, I have this. Is it OK? 127.0.0.1 localhost ::1 localhost Update 3 I

cli command ng new not working for angular 7

≯℡__Kan透↙ 提交于 2019-12-13 00:56:04
问题 Just updated my cli, npm, ng and nodejs to latest versions. An ng v gives this: Angular CLI: 7.0.2 Node: 8.12.0 OS: darwin x64 Angular: ... Package Version ------------------------------------------------------ @angular-devkit/architect 0.10.2 @angular-devkit/core 7.0.2 @angular-devkit/schematics 7.0.2 @schematics/angular 7.0.2 @schematics/update 0.10.2 rxjs 6.3.3 typescript 3.1.3 Update old Angular 6 projects successfully also. However, upon issuing the command ng new myproj , I get the

How can I use ViewChildren to get multiple native elements using template variables?

冷暖自知 提交于 2019-12-13 00:25:05
问题 I'm trying to use ViewChildren to get an Array of stacked canvas elements from my template so I can later draw on them like layers in a drawing program. drawing.component.html <canvas #canvaslayer style="z-index: 0;"></canvas> <canvas #canvaslayer style="z-index: 1;"></canvas> <canvas #canvaslayer style="z-index: 2;"></canvas> drawing.component.ts @Component({ selector: 'app-drawing', templateUrl: './drawing.component.html', }) export class DrawingComponent implements OnInit { @ViewChildren(

Angular7: Template parse errors: The pipe 'titlecase' / 'slice' could not be found

喜夏-厌秋 提交于 2019-12-12 19:06:55
问题 I'm migrating my app from Angular 6 to Angular 7 After running ng update , and updating my packages , things goes well until i run: ng build --configuration=production it seems that it can't find some angular well known pipes : titlecase / slice : ERROR in : Template parse errors: The pipe 'titlecase' could not be found ("span class="nav-item border-left text-truncate px-2 text-left"> <span class="text-capitalize">{{[ERROR ->]username | titlecase }}</span> <span class="text-capitalize"> <