Questions tagged [angular6]

Questions about Angular version 6, the web framework from Google. Use this tag for Angular questions which are specific to only version 6. Use tag Angular for any Angular questions which are not specific to an individual version.

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

You can read more about Angular version 6 here

You can find Angular version 6 official documents here

7869 questions
28
votes
5 answers

How to specify environment via `ng build` in Angular 6 app

In Angular 5, we could generate build for different environments using ng build --prod --env=uat After migration to Angular 6 the above command throws error Unknown option: '--env'
Nehal Damania
  • 8,671
  • 9
  • 37
  • 52
27
votes
6 answers

Angular 6 validate number input

I have an input and the type is number. I want to set min and max, if the input is out of this range (< min or >max), the error will be displayed. My problem is that if the input is not empty but invalid, the error disappears (example: min =10, max…
anhtv13
  • 1,636
  • 4
  • 30
  • 51
27
votes
2 answers

How get checked value from radio button angular

I need to get value from radio button in angular. Suppose to have this html code:
27
votes
3 answers

Using Virtual Scroll in Angular Material 2 Table with @angular/cdk-experimental

I have a table displays so many rows, I want to optimize the performance of it. I've found a solution by using Virtual Scroll technique. Here is an example of Angular Material CDK Vritual Scroll Viewport Component with a simple div I've…
Seanghay
  • 1,076
  • 1
  • 11
  • 24
27
votes
9 answers

Angular 6 CLI -> how to make ng build build project + libraries

So the question is pretty basic but I can't find it. I created a new app through ng new my-project, followed by a ng g library my-library. Then I executed the command ng build, but is is only building my app, and not my library or my e2e projects.…
dendimiiii
  • 1,659
  • 3
  • 15
  • 26
26
votes
4 answers

Is there an Angular 2+ Equivalent to React Fragments?

I would like to extract a portion of a component without actually creating an additional "wrapper" element in the physical DOM, because it breaks my CSS. Example: I noticed a section in my HTML template that looks like…
Cameron Yick
  • 708
  • 1
  • 8
  • 16
26
votes
4 answers

What is observable, observer and subscribe in angular?

I am learning angular and i got confuse in these observable, observer and subscribe thing. So please explain.
Amit Sharma
  • 668
  • 1
  • 6
  • 14
26
votes
1 answer

Include "assets" in your angular 6 library

It has been weeks now, that I search for a solution. I created (with ng generate library) a library with the UI in for new webprojects here at work... in fact every component in that "template library" has the ViewEncapsulation.None set... I know…
Michael Bruyninckx
  • 738
  • 1
  • 8
  • 16
26
votes
3 answers

angular cli 6, ng test not working

I have just updated my angular project to angular 6. ng build and ng serve work, but when I run my tests with the command: ng test I get the output: Schema validation failed with the following errors: Data path "" should have required property…
user3594184
  • 805
  • 2
  • 9
  • 15
25
votes
2 answers

How to check if an input field is in focus in Angular 7

I have a form and I want to know if any of the input fields in the form are focused or not? I read the 'NgForm' documentation but didn't find anything related to 'focus'. I found touched but it doesn't satisfy needs.
Ajeet Eppakayala
  • 1,186
  • 1
  • 10
  • 17
25
votes
6 answers

Angular Material component not working: 'mat-option' is not a known element

I am trying to add angular material component. but the component did not work properly. that error said Uncaught Error: Template parse errors: 'mat-option' is not a known element: // ... I think the error comes from app.module.ts: import {…
kumara
  • 877
  • 4
  • 19
  • 43
25
votes
5 answers

Angular 6 building a library with assets

Upon building & packaging an Angular 6 library, I can't seem to be able to instruct the Angular CLI to copy the library's assets into the dist/assets folder on every build. Assuming the project's folder structure is this - - dist - e2e -…
dev7
  • 6,259
  • 6
  • 32
  • 65
25
votes
5 answers

Angular 6 Update - rxjs-5-to-6-migrate command not found

In the upgrade process from update.angular.io: Remove deprecated RxJS 6 features using rxjs-tslint auto update rules. For most applications this will mean running the following two commands: npm install -g rxjs-tslint rxjs-5-to-6-migrate -p…
Kyle Krzeski
  • 6,183
  • 6
  • 41
  • 52
24
votes
1 answer

Is there a way to remove html tags from a string in JavaScript?

I am working with the rich text editor component of primeng. This editor turns everything i type in into html. But sometimes i want to output these texts in plain text instead. Does angular 2 provide a way to easily remove the html tags from the…
Maurice
  • 6,698
  • 9
  • 47
  • 104
24
votes
7 answers

Angular 6 - httpClient passing basic auth in httpOptions

I have a service in Angular 6 and I'm trying to change a record but it's saying I'm not authorized. Right now I have this: const httpOptions = { headers: new HttpHeaders({'Content-Type': 'application/json'}) }; update(id, title, content) { …
user9855223