Questions tagged [angular5]
Questions about Angular version 5, the web framework from Google. Use this tag for Angular questions which are specific to only version 5. Use tag Angular for any Angular questions which are not specific to an individual version.
angular5
6,540
questions
226
votes
11
answers
167k
views
Expected validator to return Promise or Observable
I'm trying to do a custom validation on Angular 5 but I'm facing the following error
Expected validator to return Promise or Observable
I just want to return an error to the form if the value doesn't ...
224
votes
20
answers
253k
views
Angular 5 - Copy to clipboard
I am trying to implement an icon that when clicked will save a variable to the user's clipboard. I have currently tried several libraries and none of them have been able to do so.
How do I properly ...
218
votes
15
answers
418k
views
Set focus on <input> element
I am working a front-end application with Angular 5, and I need to have a search box hidden, but on click of a button, the search box should be displayed and focused.
I have tried a few ways found on ...
211
votes
45
answers
737k
views
Angular CLI Error: The serve command requires to be run in an Angular project, but a project definition could not be found
When running the terminal commands ng server or ng serve --live-reload=true, I'm getting this issue:
The serve command requires to be run in an Angular project, but a
project definition could not ...
158
votes
6
answers
45k
views
Angular 6 - Why use @ngrx/store rather than service injection
I am recently learning Angular 6 with @ngrx/store while one of the tutorial is to use @ngrx/store for state management, however I don't understand the benefit of using @ngrx/store behind the scene.
...
133
votes
7
answers
141k
views
How to change page title with routing in Angular application?
Is there any npm module/ other way like React-Helmet that allows us to change page title as we route through our Angular application?
PS: I am using Angular 5.
129
votes
21
answers
228k
views
NullInjectorError: No provider for MatDialogRef
I can't inject MatDialogRef as it described in documentation: https://material.angular.io/components/dialog/overview
When i'm trying to do it i'v got error:
ERROR Error: StaticInjectorError[...
119
votes
9
answers
247k
views
Read response headers from API response - Angular 5 + TypeScript
I'm triggering a HTTP request and I'm getting a valid response from it. The response also has a header X-Token that I wish to read. I'm trying the below code to read the headers, however, I get null ...
119
votes
8
answers
524k
views
How to add CORS request in header in Angular 5
I have added the CORS in header but I am still getting the CORS issue in my request. What is the correct way to add and handle CORS and other requests in the headers?
Here is service file code:
...
107
votes
26
answers
343k
views
Error: Schema validation failed with the following errors: Data path "" should NOT have additional properties(project)
After migrating application from angular 5 to 6, on running ng serve the following errors pop up.
Schema validation failed with the following errors:
Data path "" should NOT have additional ...
103
votes
6
answers
282k
views
How to add icon to mat-icon-button
I am using Angular with Material
<button mat-icon-button><mat-icon svgIcon="thumb-up"></mat-icon>Start Recording</button>
I am trying to add an icon to button, but I can't ...
98
votes
3
answers
22k
views
Angular Service Worker - Failed to load resource: the server responded with a status of 504 (Gateway Timeout)
I am using the Angular-CLI 1.6.6 and @angular/service-worker 5.2.5 in our Angular 5.2.5 app. Everything works fine on the local lite-server, as well as on the production server, except for one error ...
92
votes
9
answers
264k
views
Angular 5 Button Submit On Enter Key Press
I have an Angular 5 form application using all the usual models but on the forms I want the form to submit without having to physically click on the 'Submit' button.
I know it's normally as easy as ...
90
votes
14
answers
123k
views
Angular 5: "No provider for ControlContainer"
I have a little web app with Angular 5 and out of a sudden I am getting this strange error message in my browser console:
ncaught Error: Template parse errors:
No provider for ControlContainer ("
...
80
votes
6
answers
70k
views
How override Provider in Angular 5 for only one test?
In one of my unit test files, I have to mock several times the same service with different mocks.
import { MyService } from '../services/myservice.service';
import { MockMyService1 } from '../mocks/...