angular6

'ng-select' is not a known element

风流意气都作罢 提交于 2020-05-15 02:16:10
问题 this is my code: I want to add on my form https://github.com/ng-select/ng-select multi select for tags input. components.module.ts: import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { HttpClientModule } from '@angular/common/http'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { NgSelectModule } from '@ng-select/ng-select'; @NgModule({ imports: [ CommonModule, HttpClientModule, FormsModule, ReactiveFormsModule,

Get parent hierarchy from a child node in angular 6 material tree

拟墨画扇 提交于 2020-05-10 09:58:30
问题 I am following a tutorial to implement cdk tree in angular 6. I created a tree structure, now I want to get the parent hierarchy from from the child by making it clickable, while there are methods like getDescendants to get children of a node, vice versa is not available. How can I get the parent hierarchy from a child or leaf node. 回答1: I've added these methods to my tree component. Note that I use the flat tree, this won't work for a nested tree. @Component({ selector: 'es-outline-tree', //

How can i use mdi icons in angular 6

好久不见. 提交于 2020-05-01 00:34:28
问题 I am trying to configure mdi icons with @angular/material in my mini-project. I have tried several tutorials but with no avail. When registering the icon set following the tutorial (as shown below), I get some errors... constructor(matIconRegistry: MatIconRegistry, domSanitizer: DomSanitizer) { matIconRegistry.addSvgIconSet(domSanitizer.bypassSecurityTrustResourceUrl('./assets/mdi.svg')); } Here is my code... app.module.ts import { BrowserModule } from '@angular/platform-browser'; import {

How can i use mdi icons in angular 6

♀尐吖头ヾ 提交于 2020-05-01 00:33:49
问题 I am trying to configure mdi icons with @angular/material in my mini-project. I have tried several tutorials but with no avail. When registering the icon set following the tutorial (as shown below), I get some errors... constructor(matIconRegistry: MatIconRegistry, domSanitizer: DomSanitizer) { matIconRegistry.addSvgIconSet(domSanitizer.bypassSecurityTrustResourceUrl('./assets/mdi.svg')); } Here is my code... app.module.ts import { BrowserModule } from '@angular/platform-browser'; import {

Angular 8: Not getting selected dropdown values in component using Reactive Form

ぐ巨炮叔叔 提交于 2020-04-30 07:04:26
问题 I am dynamically populating drop downs and it's values. After selecting all the value when I click on the submit button I am not able to set it's value in form, I am getting blank values. HTML: <div class="col-md-6" *ngFor="let type of types"> <div class="form-group"> <label>Select {{ type.cat_name }}</label> <select class="form-control custom-select" (change)="onChangeType($event.target.value)" [value]="type.key_name" > <option value="">-- Select --</option> <ng-container *ngFor="let subType

Angular 8: Not getting selected dropdown values in component using Reactive Form

自闭症网瘾萝莉.ら 提交于 2020-04-30 07:04:01
问题 I am dynamically populating drop downs and it's values. After selecting all the value when I click on the submit button I am not able to set it's value in form, I am getting blank values. HTML: <div class="col-md-6" *ngFor="let type of types"> <div class="form-group"> <label>Select {{ type.cat_name }}</label> <select class="form-control custom-select" (change)="onChangeType($event.target.value)" [value]="type.key_name" > <option value="">-- Select --</option> <ng-container *ngFor="let subType

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

隐身守侯 提交于 2020-04-18 07:19:08
问题 This question already has answers here : Detect Input Focus Using Angular 2+ (3 answers) Closed 8 months ago . 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. 回答1: You can use the focus and blur events, to track as fields gain or lose focus : <input (focus)="onFocus()" (blur)="onBlur()"> There are also javascript’s own :

Angular 6 - @ViewChild Access value of nativeElement span class

此生再无相见时 提交于 2020-04-16 05:08:07
问题 I am using @ViewChild is Angular. On my app.component.html I have: <div #somename>Mark<span class="somethingelse">Hello something else</span></div> And on my app.component.ts @ViewChild('somename') SomeName; constructor() {} getInputValue() { alert(this.SomeName.nativeElement('span').getElementByClassName('somethingelse').innerHTML); } This is not returning anything. My question is how to I target the span's class and get it's value? 回答1: Your view child should be: @ViewChild("somename")

How to set different width for different form in mat-horizontal-stepper

本秂侑毒 提交于 2020-04-16 03:09:06
问题 I want to set different width for different form in mat-step.The content in first form to be as width of 400px and the second form content to be as width of 700px. <mat-horizontal-stepper labelPosition="bottom" #stepper> <mat-step [stepControl]="firstFormGroup"> <form [formGroup]="firstFormGroup"> <ng-template matStepLabel>Fill out your name</ng-template> <div style="width:400px"> <mat-form-field> <input matInput placeholder="Last name, First name" formControlName="firstCtrl" required> </mat

How to set different width for different form in mat-horizontal-stepper

房东的猫 提交于 2020-04-16 03:08:53
问题 I want to set different width for different form in mat-step.The content in first form to be as width of 400px and the second form content to be as width of 700px. <mat-horizontal-stepper labelPosition="bottom" #stepper> <mat-step [stepControl]="firstFormGroup"> <form [formGroup]="firstFormGroup"> <ng-template matStepLabel>Fill out your name</ng-template> <div style="width:400px"> <mat-form-field> <input matInput placeholder="Last name, First name" formControlName="firstCtrl" required> </mat