angular6

Angular 6 Server Side Rendering (SSR) set status code from Component

懵懂的女人 提交于 2021-02-07 10:37:19
问题 Is there any way to set status code like 404, 401, 500 as per requirement? I am using Angular 6. There are lots of tutorials showing solutions but those are old and not working at all. All provides showing solutions regarding different server.ts file which is not related to new file showing on Angular site. I am able to render all pages server side. When it has some unexpected content in URL, I am change route to 404 page with skipping location change option. While calling 404 component, I

Using Virtual Scroll in Angular Material 2 Table with @angular/cdk-experimental

折月煮酒 提交于 2021-02-05 20:00:16
问题 I have a table displays so many rows, I want to optimize the performance of it. I've found a solution by using Virtual Scroll technique. Here is an example of Angular Material CDK Vritual Scroll Viewport Component with a simple div I've found: <cdk-virtual-scroll-viewport class="list-container lg" [itemSize]="52.5"> <div *cdkVirtualFor="let state of statesObservable | async;" class="list-group-item"> <div class="state">{{state.name}}</div> <div class="capital">{{state.capital}}</div> </div> <

Using Virtual Scroll in Angular Material 2 Table with @angular/cdk-experimental

旧街凉风 提交于 2021-02-05 19:59:57
问题 I have a table displays so many rows, I want to optimize the performance of it. I've found a solution by using Virtual Scroll technique. Here is an example of Angular Material CDK Vritual Scroll Viewport Component with a simple div I've found: <cdk-virtual-scroll-viewport class="list-container lg" [itemSize]="52.5"> <div *cdkVirtualFor="let state of statesObservable | async;" class="list-group-item"> <div class="state">{{state.name}}</div> <div class="capital">{{state.capital}}</div> </div> <

Using Virtual Scroll in Angular Material 2 Table with @angular/cdk-experimental

可紊 提交于 2021-02-05 19:59:27
问题 I have a table displays so many rows, I want to optimize the performance of it. I've found a solution by using Virtual Scroll technique. Here is an example of Angular Material CDK Vritual Scroll Viewport Component with a simple div I've found: <cdk-virtual-scroll-viewport class="list-container lg" [itemSize]="52.5"> <div *cdkVirtualFor="let state of statesObservable | async;" class="list-group-item"> <div class="state">{{state.name}}</div> <div class="capital">{{state.capital}}</div> </div> <

Is there a way to customize angular date picker?

喜欢而已 提交于 2021-02-05 11:14:47
问题 I need help in customizing the angular material date picker i.e,https://material.angular.io/components/datepicker/overview. The calendar should not close once we click on the date. I should be able to have 2 buttons, one is 'cancel' and another is 'save'. Once the save button is clicked, the calendar should be closed. 回答1: I don't know if it's a better solution, but based on this SO answer, I think that the solution is use a menu with a calendar inside. As we need an input we need at least

Is there a way to customize angular date picker?

白昼怎懂夜的黑 提交于 2021-02-05 11:14:11
问题 I need help in customizing the angular material date picker i.e,https://material.angular.io/components/datepicker/overview. The calendar should not close once we click on the date. I should be able to have 2 buttons, one is 'cancel' and another is 'save'. Once the save button is clicked, the calendar should be closed. 回答1: I don't know if it's a better solution, but based on this SO answer, I think that the solution is use a menu with a calendar inside. As we need an input we need at least

Problem with <ul><li> using Angular 6 and Typescript

匆匆过客 提交于 2021-01-29 14:50:51
问题 I have this situation... Here's the code: <div id="botcont{{i}}"> <img *ngIf="!paperRoll[1]" id="imgbot{{i}}" class="minibot" src="img/bot_l.svg" alt=""/> <div *ngIf="!paperRoll[1]" class="arrow_box"> <div *ngFor="let message of paperRoll[0]"> <span *ngIf="!message[1]" [innerHTML]="message[0]"> <span *ngIf="message[1]"> <a href="javascript:;" (click)="buttonClick(message[0])" [innerHTML]="message[0]"></a> </span> </span> </div> </div> </div> NOTE: The li's are the problem. When it renders, it

Angular Reactive form validation

我是研究僧i 提交于 2021-01-29 14:16:08
问题 I'm working with a Reactive form and I have noticed in some tutorials they do the following: HTML . . <input type="text" formControlName="firstName" required> . . TS . . firstName: ['', Validators.required] . . QUESTION: Why do I need to specify "required" in the HTML if I just do it in the TS file it works fine? 回答1: Actually, Angular mention something about that here: Caution: Use these HTML5 validation attributes in combination with the built-in validators provided by Angular's reactive

ngfor use index in elements click event

倾然丶 夕夏残阳落幕 提交于 2021-01-29 13:43:59
问题 I am trying to make a remove button on my chips so I tried: <mat-chip-list> <mat-chip *ngFor="let condition of conditions; let i = index"> {{condition.column.friendlyName}} {{condition.operator.symbol}} {{condition.value}} <mat-icon class="close-icon" (click)="removeChip(i)">highlight_off</mat-icon> </mat-chip> </mat-chip-list> but it says i is not defined. What is correct way to get the chips index when it is clicked? 回答1: this is updated in angular 5+ to index as i : <mat-chip *ngFor="let

HttpClient dont return all headers [duplicate]

帅比萌擦擦* 提交于 2021-01-29 10:34:53
问题 This question already has an answer here : Angular 6 Get response headers with httpclient issue (1 answer) Closed 2 years ago . I'm trying to read some custom headers ("etag") from a httpresponse with angular 6 app: getProvider(providerName: string, version: string): Observable<any> { if (providerName && version) { var url = `${this.baseUrl}/v1/config/provider/version/${version}/${providerName}`; return this._http.get(url, { observe: 'response' }) .pipe( map(response => { console.log("keys: "