angular-material

No value accessor for form control with name… for mat-select controls

坚强是说给别人听的谎言 提交于 2021-02-18 20:09:24
问题 I am making some unit test with jasmine and karma for an angular 6 app that validate if a formGroup field is valid. I am experiencing problems with mat-select control. when I run the test case, Karma fires me an error saying Error: No value accessor for form control with name: 'importId' . By the way, the component works fine as I expected. This is my component: import {Component, Inject, OnInit} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material"; import

Get multiple ng-template ref values using contentChildren in angular 5

回眸只為那壹抹淺笑 提交于 2021-02-18 10:36:09
问题 I am trying to pass multiple ng-template to my reusable component (my-table component), content projection. Now I need to get the reference value of each passed ng-template so I can use that value to know, which template is passed for which column. Basically I am creating a reusable table component (on top of Angular material table) where user can pass an separate template for each column. Kindly suggest - OR is there a better approach of doing this? temp.component.ts import { Component,

Object literal may only specify known properties, and 'buttons' does not exist in type 'Settings

僤鯓⒐⒋嵵緔 提交于 2021-02-16 20:10:18
问题 I am using Angular 8 and following example from here but and the exception is Please help me solve this. 回答1: Just make sure the dtOptions is declared as any . You can find this comment on: https://l-lin.github.io/angular-datatables/#/extensions/buttons // Must be declared as "any", not as "DataTables.Settings" dtOptions: any = {}; 回答2: If the Type Settings has been defined by you or your team, you must add the buttons property as: buttons: any[]; Or buttons?: any[]; To keep retro

Angular material io predefined theme color

早过忘川 提交于 2021-02-11 13:46:30
问题 How do I access the color variables ( $primary, $accent, $warn, $foreground, $background) in scss file from a predefined angular theme @angular/material/prebuilt-themes/deeppurple-amber.css'? 回答1: Once a sass file has been compiled to css, there is no more notion of variable inside that css file, so you won't be able to retrieve variables like $primary from deeppurple-amber.css . If you look at the scss source file for the deeppurple-amber theme, you can find the definition for $primary and

How to set background image in div-element in Angular Material app?

若如初见. 提交于 2021-02-11 07:43:57
问题 I know this has been asked, but none of the solutions work. I have following html and I can get the image displayed if I use the commented img-element <img src="assets/utgmap.jpg"> and comment away the following div-element. However I would like to have background image for the div instead and it's not working. CSS definition is in the end of the file and there's no 404 error for the image so it can be fetched but is is not displayed. HTML: <mat-sidenav-container class="sidenav-container">

How to format Angular Material date-picker inside Formly form for service layer (not display format)

杀马特。学长 韩版系。学妹 提交于 2021-02-11 06:51:25
问题 I would like to expose my date value as date only ("yyyy-MM-dd") on an Angular Material date picker. Currently, the default date value is an ISO format (includes time). I have a starter Stackblitz project with the the required setup. The formly-datepicker.type is where I would like to centralize the conversion so that any date used in the model will be formatted properly for the service layer. One of my attempts to accomplish it in a centralized manner is using the Angular

Angular material Table with expandable rows, automaticly expanded when change tabs With stackBlitz example

你说的曾经没有我的故事 提交于 2021-02-11 06:35:48
问题 I have an Angular material table with expandable rows. In every row, I have multiple tabs, On the first tab, I have another table with expandable rows. At the start al the rows are collapsed, so far so good. When I click a row, the row is expanded, again so far, so good. When I change tabs and come back, all my rows are expanded. How can I solve this issue? The HTML code is like Angular material describes on their page for a table with expandable rows. I created a StackBlitz with my problem,

Showing Material Checkbox Animation On Hover

白昼怎懂夜的黑 提交于 2021-02-10 18:43:41
问题 Check out the effect at this link where the circular background of the checkbox is shown on hover. How can I get this same behavior while using <mat-checkbox> in Angular? I want the background to show on hover as well as the normal animation on transitions from checked to unchecked, unchecked to checked, etc. I am using @angular/material version 6.4.5. By inspecting the documentation for version 7.1.1, a persistent-ripple class is applied to a <div> inside the checkbox on hover. This does not

Remove selected option from dropdown after select

六眼飞鱼酱① 提交于 2021-02-10 16:38:23
问题 I have a scenario that i need to show dropdowns with selected or default values in view if there is any data from API. And i can add new dropdowns using add button. But i have to select value from drop downs only once so it will not repeated. I am using ngFor loop to show this drop downs and i am using splice method to remove selected options from drop down. And i am facing a issue here that Example: If i select car 1 from 1st drop down 1 and the 2nd drop down i can not see car 1 but if i go

Iterate through dataSource in mat-table Angular

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-10 12:36:06
问题 I have problem with iterations through dataSource, where I have data for mat-table <div *ngFor="let element of arrayMain" id = "{{element}}" class="my_item"> <div><span class="skuska"><span class="mat-subheading-2">{{element}}</span></span></div> <mat-table #table [dataSource]="dataSource[1]" matSort> <ng-container matColumnDef="{{column.id}}" *ngFor="let column of columnNames"> <mat-header-cell *matHeaderCellDef mat-sort-header > {{column.value}} </mat-header-cell> <mat-cell *matCellDef="let