ng2-charts update labels and data

Apparently, if you do not modify the original reference to the labels array, it seems to work, at least for me. I mean, if you want a completely different set of labels, you should do something like this: In the template: <canvas baseChart [datasets]=”lineChartData” [labels]=”lineChartLabels” [options]=”lineChartOptions” [chartType]=”‘line'”></canvas> In the ts component: this.lineChartLabels.length = 0; for … Read more

angular2-cli include custom fonts

For the people arriving here by searching: Install with npm: npm install roboto-fontface –save Add to styles in .angular-cli.json (apps[0].styles): “styles”: [ “styles.css”, “../node_modules/roboto-fontface/css/roboto/roboto-fontface.css” ], That’s all! Edit: since Angular 6 this file is called angular.json instead of angular-cli.json. Adding fonts still works the same way as before.

Spring Boot with redirecting with single page angular2

If you’re tired of trying to solve this problem by following so many conflicting solutions – look here!! After hours upon hours trying to follow all the scattered advice from dozens of stack overflow and blog posts, I’ve finally found the minimum PURE spring boot + angular 6 application to always redirect to index.html after … Read more

Angular interceptor exclude specific urls

Update from Angular 12, use “context”, see this SO I suggest that, in spite of check the request, you can use the header to add a “skip” property, if the header has the skip property, simple return the reqs export class CustomInterceptor implements HttpInterceptor { intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { if (req.headers.get(“skip”)) return next.handle(req); … Read more

Apply a condition using ngFor and ngIf in angular 2 [duplicate]

I would flip-flop your button and div: <div *ngFor=”let item of items”> <button *ngIf=”(item.data.type == 1)”>{{item.data.name}}</button> </div> This way only buttons get created for valid items. If <div>‘s aren’t desirable use <ng-container> instead. Though not advisable due to performance reasons, you can also use a function in your component: <button *ngFor=”let item of filterItemsOfType(‘1’)”>{{item.data.name}}</button> Where … Read more

Pass inputs to nested component in Angular 2

I’m not sure if I got it right but here is my implementation ( PLUNKER ) const FIRST_PARTY_OWN_INPUTS = [‘not’, ‘passthrough’]; const FIRST_PARTY_PASSTHROUGH_INPUTS = [‘all’, ‘attrs’, ‘are’, ‘passed’]; const generateAttributes(arr) { return arr.map(att => ‘[‘ + att + ‘] = “‘ + att + ‘”‘).join(‘ ‘); } //——————————————————-////////////////// import {Component} from ‘@angular/core’ @Component({ selector: ‘third-party’, … Read more