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.

Questions about Angular version 5, the web framework from Google.

You can read more about Angular version 5 here

You can find Angular version 5 official documents here

6545 questions
217
votes
20 answers

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 copy a variable to the user's clipboard in Angular…
anonymous-dev
  • 2,356
  • 2
  • 11
  • 17
207
votes
11 answers

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 match the required, here's my code: This is the…
206
votes
45 answers

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 be found.
Gurpreet Singh
  • 3,061
  • 5
  • 19
  • 36
202
votes
15 answers

Set focus on 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 StackOverflow with directive or so, but can't…
Bob
  • 2,043
  • 2
  • 9
  • 5
150
votes
6 answers

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. For example, for a simple login and signup action,…
Drex
  • 3,346
  • 9
  • 33
  • 58
122
votes
20 answers

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:…
rc21
  • 1,730
  • 2
  • 12
  • 14
117
votes
8 answers

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: import { HttpClient, HttpHeaders, HttpClientModule }…
Aman Kumar
  • 1,572
  • 4
  • 17
  • 25
114
votes
9 answers

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 as a result this.currentlyExecuting.request =…
Sahil Khanna
  • 4,262
  • 8
  • 47
  • 72
113
votes
7 answers

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.
Peter
  • 10,492
  • 21
  • 82
  • 132
97
votes
6 answers

How to add icon to mat-icon-button

I am using Angular with Material I am trying to add an icon to button, but I can't figure out how to do it, and can't find documentation for…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
95
votes
23 answers

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 properties(project). Error: Schema validation failed…
V5NEXT
  • 1,907
  • 4
  • 19
  • 38
94
votes
3 answers

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 message popping in our production environment:…
88
votes
14 answers

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 ("

Marvin H.
  • 1,239
  • 1
  • 9
  • 20
85
votes
9 answers

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 adding type=submit to my button element but it does…
murday1983
  • 3,806
  • 14
  • 54
  • 105
74
votes
3 answers

Angular 5 Reactive Forms - Radio Button Group

I have 2 radio buttons, I'm using reactive forms and I have added the form controls within my component. The issue I am facing is that the name attribute has to be the same as the formControlName. When I set the name attribute as the same, I can…
Taranjit Kang
  • 2,510
  • 3
  • 20
  • 40
1
2 3
99 100