How to use the MatTableDataSource with an observable?

You should be able to new up the MatTableDataSource once at the class level and then use the data setter in ngOnInit. dataSource = new MatTableDataSource<Thing>(); @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; @ViewChild(MatSort, { static: true }) sort: MatSort; ngOnInit() { getThings().subscribe(things => { this.dataSource.data = things; this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; }); … Read more

Blocked because of a disallowed MIME type (“text/html”) : Angular 8 deployed on tomcat 9.0.30 fails to serve the assets

<base href=”https://stackoverflow.com/”> is the issue , change it to your context root . Or change it to <base href=”https://stackoverflow.com/questions/59925804/.”> Browser is unable to find your JS file because it looks for JS file relative to base href. Your base href= “https://stackoverflow.com/” , so it looks for all js file in the in “localhost:8080/”, but your … Read more

How to reload or refresh only child component in Angular 8

Best way to update a child component is: ngOnChanges() ngOnChanges(): “A lifecycle hook that is called when any data-bound property of a directive changes. Define an ngOnChanges() method to handle the changes.” We use this lifecycle hook to respond to changes to our @Input() variables. Example: import { Component, Input, OnChanges } from “@angular/core”; @Component({ … Read more

error TS2554: Expected 2 arguments, but got 1 with @ViewChild

After migration to Angular 8 you should declare manually if it’s static or not @ViewChild(QuilldEditorComponent, {static: true}) quillEditorComponentInstance; If you have further questions ask them or for more details please read this issue https://github.com/angular/angular-cli/issues/14553 or take a look at offical documentation https://angular.io/guide/static-query-migration // query results available in ngOnInit @ViewChild(‘foo’, {static: true}) foo: ElementRef; OR // … Read more

NgRX effects – Type ‘Observable’ is not assignable to type ‘Observable’

Quick version comment out createEffect(() =>, fix errors that your IDE (VSCode) flags up, add createEffect(() => back in. Alternative – rewriting like the following also works someEffect$ = createEffect(() => { return this.actions$.pipe( … ) }) Additional Still errors after doing the above? Type-checking is doing it’s job correctly and telling you that you … Read more

Call retries were exceeded exception while ng build

Update 10.02.2019 This was a problem of the @angular/cli. Updating the version to >= 8.3.22 should fix the issue: see this comment in #16515 ORIGINAL Basically the build process is running out of memory: see related angular-cli issues #15493, #16515 The recommended remedy is to: update node to the latest version e.g. 12.14.0 increase the … Read more

How do I support Internet Explorer in an Angular 8 application?

According to this issue reply You need to follow the following steps Create a new tsconfig tsconfig.es5.json next to tsconfig.json with the below contents { “extends”: “./tsconfig.json”, “compilerOptions”: { “target”: “es5” } } In angular.json Under projects:yourAppName:architect:build:configurations, add “es5”: { “tsConfig”: “./tsconfig.es5.json” } and projects:yourAppName:architect:serve:configurations add “es5”: { “browserTarget”: “yourAppName:build:es5” } Remember to change yourAppName … Read more