Questions tagged [angular8]
Questions about Angular version 8, the web framework from Google. Use this tag for Angular questions which are specific to only version 8. Use tag Angular for any Angular questions which are not specific to an individual version.
angular8
4,730
questions
338
votes
9
answers
215k
views
How should I use the new static option for @ViewChild in Angular 8?
How should I configure the new Angular 8 view child?
@ViewChild('searchText', {read: ElementRef, static: false})
public searchTextInput: ElementRef;
vs
@ViewChild('searchText', {read: ElementRef, ...
185
votes
11
answers
113k
views
Angular 8 - Lazy loading modules : Error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'
When I updated Angular from 7 to Angular 8, getting error for lazy loading modules
I have tried the options, which are there in the angular upgradation guide
Made the below changes:
Before
...
176
votes
10
answers
279k
views
Repository is not clean. Please commit or stash any changes before updating In Angular 8
Error
Repository is not clean. Please commit or stash any changes before updating
when i have updated from version 7 to Angular 8.
Angular Guide for upgrade https://update.angular.io/#7.0:8.0
...
152
votes
12
answers
82k
views
Job name "..getProjectMetadata" does not exist
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....
86
votes
13
answers
87k
views
How do I support Internet Explorer in an Angular 8 application?
When I generate a project with Angular CLI (8.0.0), I run ng serve, open the application up in Internet Explorer and I am presented with a blank screen.
I had a look at the polyfills.ts files and I ...
76
votes
11
answers
90k
views
Call retries were exceeded exception while ng build
I am facing an exception while ng build (generating ES5 bundles for differential loading...)
An unhandled exception occured: Call retires were exceeded
Used versions:
Angular-CLI: 8.3.20
Angular: 8....
70
votes
12
answers
73k
views
NgRX effects - Type 'Observable<unknown>' is not assignable to type 'Observable<Action>'
While working with NgRX 8 my colleagues and me are frequently facing a weird error message when implementing the effects.
Type 'Observable<unknown>' is not assignable to type 'Observable<...
68
votes
11
answers
150k
views
Angular - No pipe found with name
I've created a pipe using "ng g pipe" command. I'm getting a console error when I'm using it in my code.
The screenshots of the code are attached below.
Error: error NG8004: No pipe found with name '...
61
votes
7
answers
163k
views
Blocked because of a disallowed MIME type (“text/html”) : Angular 8 deployed on tomcat 9.0.30 fails to serve the assets
I have a project in which the user interface is based on angular 8 and the backend is a springboot java service. The entire project is a multi module project with the angular part being a separate ...
52
votes
6
answers
131k
views
How to reload or refresh only child component in Angular 8
I have two components, One parent and Other Child.
HTML Part
<div>
<div class="row col-md-12">
<div class="col-md-4">
<!-- Some HTML Code of Parent component over ...
52
votes
2
answers
34k
views
Is not core-js needed anymore?
I've updated an Angular project from version 7 to 8. Everything runs smoothly, schematics did it's job (maybe) and we are Ok (project is even in production). When we're updating Angular CLI, we always ...
51
votes
2
answers
71k
views
error TS2554: Expected 2 arguments, but got 1 with @ViewChild
I was using ViewChild as follows:
@ViewChild("InternalMedia") localStream;
@ViewChild("emoji") mEmoji;
Which was working fine till angular-7.x
as soon as I upgraded it to angular-8.x it started ...
43
votes
6
answers
57k
views
How to use the MatTableDataSource with an observable?
I am using the mat-table and I am trying to use the MatTableDataSource with an observable (I get the data from a web service), but I don't know how to configure the MatTableDataSource to use an ...
38
votes
7
answers
19k
views
Angular 8 ng-build throwing MIME error with cordova
While executing ng build --prod --base-href ./ for building my cordova app, the final output throws an error as below.
Failed to load module script: The server responded with a non-JavaScript MIME ...
36
votes
12
answers
66k
views
Angular 8 viewChild returns undefined
I am trying to access the childView instance but it keeps saying the the childView is undefined.
Here is my code for childViews:
@ViewChild(CreateQuestionnaireComponent,{ read: true, static: false })...
29
votes
1
answer
22k
views
Package '@angular/core' is not a dependency. while updating angular 8 to angular 9
While updating angular 8 project to angular 9 , getting error
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 0 dependencies.
Package '@...
28
votes
5
answers
72k
views
Type 'AbstractControl' is missing the following properties from type 'FormGroup': controls, registerControl, addControl, removeControl, and 3 more
we recently upgraded from ng 7.2.15 and typescript 3.2.4 to angular v8.2.14 and typescript v3.5.3.
Passing the form group from a parent component to child component is no longer working.
Below is my ...
26
votes
4
answers
64k
views
How to implement behavior subject using service in Angular 8
I'm new to Angular and I'm having an issue.
I'm creating an app with several sibling components. When I update a value in one component other components don't update. I know that to resolve this ...
24
votes
14
answers
73k
views
Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class in angular 8 [duplicate]
ERROR in node_modules/@angular/common/http/http.d.ts:2801:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
2801 export declare class ...
24
votes
2
answers
16k
views
How to replace index.html in Angular 8.3+ depending on environment?
I am working on an application that was set up using jhipster, Spring Boot and Angular
I need to set up different public keys for something depending on whether the app is running on dev or prod.
I'...
24
votes
4
answers
40k
views
Preserve Symlinks in Angular Libraries
I have a problem.
I'm trying to make a Angular 8 Library using ng-cli, but i can't preserve symlinks from my external application using npm link.
I've tried to add this on my angular.json:
"...
23
votes
2
answers
18k
views
ng serve is not working after Angular 8 update
Error
Could not find the implementation for builder @angular-devkit/build-angular:dev-server
ng serve
Could not find the implementation for builder @angular-devkit/build-angular:...
22
votes
9
answers
34k
views
Why is the ion-back-button not shown?
The ion-back-button does NOT show up to the right of the ion-menu-button. Why is that?
the ion-menu-button and the ion-title show properly and aligned on the same horizantal position.
<ion-header&...
22
votes
5
answers
71k
views
How to solve catch error in Observable in angular 8?
I do error handler code, but I got error in catch. undefined method.
This is my serivce.ts code.
import { Injectable } from "@angular/core";
import { HttpClient, HttpErrorResponse } from "@angular/...
22
votes
14
answers
58k
views
Angular 8 showing blank page with no errors
I am developing an Angular 8 application that will login to a .Net Core Rest API using JWT Token Authentication.
When I start the application the application compiles successfully with no errors. ...
21
votes
11
answers
54k
views
How to solve error in HostResourceResolver?
What would be the steps to resolve this error?
ERROR in HostResourceResolver: could not resolve styles.css in context
of
C:/Users/shema/Desktop/angular/RP/ResourcePlanning/src/app/addproject/...
18
votes
1
answer
11k
views
Angular + Jest: Can't resolve all parameters for AppComponent: (?)
I am operating inside a Typescript Monorepo. I want to add an Angular 8 frontend with Jest testing to the Monorepo. But I am encountering some issues.
I am using
Angular CLI: 8.3.5
What I did
I ...
18
votes
2
answers
21k
views
Angular Tree Shaking: How exactly does it work?
We are currently trying to optimize a complex angular application (performance & bundle size).
We found that we have partially unused components, but we are not 100% sure about them. Anyway... The ...
18
votes
2
answers
5k
views
Lazy loading and setting LOCALE_ID at runtime from an API in Angular 8 application on startup
We have an approach for lazy loading and setting the LOCALE_ID of the Angular application from the API (by loading the user profile data during on startup). This worked fine on Angular 7 but when I've ...
17
votes
3
answers
15k
views
Angular v8 - @ViewChild static true or false
Angular v8 has just been released. Although it's mostly backward compatible, there's some Breaking Changes.
According to Angular's Changelog one core change is (and I quote):
"In Angular version ...
17
votes
3
answers
83k
views
How to convert datetime UTC to local time Angular? [duplicate]
I have UTC time in database.
I want to convert this time to local time in format dd.mm.yy h.m.s
How to do that?
My date is in UTC:
2019-08-08 08:57:59
In need local time +4:00
17
votes
4
answers
64k
views
Retrive selected value of ng-select - Angular8
I am a novice with Angular 8.
I created the following dropdown menu, in a component, that works very well for me:
<ng-select class="w-25 p-3" placeholder="{{'author' | translate}}" [clearable]="...
17
votes
3
answers
9k
views
Angular Application Doesn't load up App Module/Components after Upgrade to Angular 8.3.5
We have an Angular 4 project that I've recently tried to upgrade to Angular 8. I followed the migration guide in Angular website, changed some of the syntaxes, and everything preventing project to be ...
16
votes
10
answers
101k
views
How to reload a page in Angular 8 the proper way
NB. I've got a set of resulting from googling but, as I explain at the end, I sense that they aren't reliable, due to diversity.
I have two utility methods - one for navigating to the parent node and ...
16
votes
2
answers
17k
views
How to resolve an 'Invalid format version detected - Expected:[ 1 ] Found: [ 3 ]' error when creating a component in Angular 8?
I need to create a component in my project in Angular 8, I tried the following command:
ng g c prueba
but it returned back an error as:
Invalid format version detected - Expected:[ 1 ] Found: [ ...
16
votes
3
answers
40k
views
How to select only year on mat-datepicker
I'm developing an application with angular 8 in which I have an input that contains only year number.
I have used mat-datepicker and want only to choose year.
<mat-form-field class="input-...
16
votes
2
answers
8k
views
What's the difference between providing and injecting 'Window' vs Window in Angular 8 and 9?
I have two Angular projects using these versions:
9.0.0-next.6
8.1.0
In the version 9 I used this to provide and inject the window obhject:
@NgModule({
providers: [
{
provide: Window,
...
16
votes
2
answers
28k
views
Angular 8 Intercept call to refresh token
I am trying to refresh access token if current access token is expired.
I am sending multiple requests at one time and I want to make a kind of a queue, so other requests won't request refreshing ...
15
votes
3
answers
14k
views
npm run build:ssr does not work in angular 8
I use angular 8 and server-side-rendering but i got error when i run npm run build:ssr
As you can see, src is repeated twice home/app/front/**src/src**/main.server.ts
I tried everything without ...
15
votes
4
answers
10k
views
this.router.events not loading on first time in Angular
Does anyone have any idea on how to get the router events to fire the first time the component is loaded?
I am using Angular 8.
I have a deep link that moves to another component. So when I click on ...
15
votes
3
answers
18k
views
ControlValueAccessor with Error Validation in Angular Material
I am trying to apply Error Validation style with ControlValueAccessor in custom Material Input Textbox. Ever since applying this custom component, all the red border validation status with ...
15
votes
3
answers
3k
views
Improving production build time for Angular 8 application in Azure Devops
I am trying to increase Angular Build production speed with command below,
Ran the following command, however no improvement in build time, still at 14 min.
Is the --prod command making it ignore the ...
15
votes
1
answer
1k
views
Angular (8) Universal with firebase cloud functions - can't match any routes
UPDATE: I created a new project with every angular update there was and now on 8.2.0 it seems to be working. Just follow the instructions below, BUT there's currently a bug within webpack. So, after ...
14
votes
5
answers
26k
views
node_modules/ngx-toastr/toastr/toast-noanimation.component.d.ts(19,9)
shared.module.ts
import { animate, state, style, transition, trigger } from '@angular/animations';
import { ToastrModule } from 'ngx-toastr';
import { BrowserModule } from '@angular/platform-browser';...
14
votes
6
answers
73k
views
Difference between two dates in Days using angular
In my application I am getting message sent date from API response, I want to calculate the difference between current date and the date from API response in days(difference) using angular 8 and map ...
14
votes
9
answers
48k
views
How to Set Placeholder on Select Tag in Angular 8?
I am creating a dropdown to filter data so I have created a dropdown
<form #filter="ngForm" (ngSubmit)="filterta(filter)" style="display: flex;">
<select ngModel #month="ngModel" ...
14
votes
8
answers
39k
views
Angular 7/8 - How to get url parameters in app component
I have Single sign on in place but for testing I want to read the values from the url localhost:4200/?id=test&name=testing&[email protected] and pass them to an API in app component.
...
14
votes
3
answers
33k
views
Converting an Image url to base64 in Angular
I am struggling trying to convert a given image url to base64... in my case i have a String with the image's path
var imgUrl = `./assets/logoEmpresas/${empresa.logoUrl}`
how can i convert the given ...
14
votes
4
answers
15k
views
After update to Angular 8 CLI throws ".getColorDepth is not a function"
A collegue of mine upgraded our project to angular 8. I pulled his branch and run npm install. On his branch everyhing works fine. I do now get the same error every time i run any "ng ..." command:
C:...
14
votes
2
answers
6k
views
d3.js runtime error after upgrade to Angular 8
I am experimenting with upgrading my Angular 6 application to Angular 8. My code compiles, but I immediately receive a run-time error "d3.js:8 Uncaught TypeError: Cannot read property 'document' of ...