Skip to content
Snippets Groups Projects
Commit 6d4e5b7a authored by jojohoch's avatar jojohoch
Browse files

Use new mdc based material classes in InputBackgroundColorDirective

parent 4dab4095
No related branches found
No related tags found
No related merge requests found
...@@ -2,9 +2,7 @@ import { ...@@ -2,9 +2,7 @@ import {
Directive, ElementRef, Input, OnChanges, SimpleChanges Directive, ElementRef, Input, OnChanges, SimpleChanges
} from '@angular/core'; } from '@angular/core';
@Directive({ @Directive({ selector: '[aspectInputBackgroundColor]'})
selector: '[aspectInputBackgroundColor]'
})
export class InputBackgroundColorDirective implements OnChanges { export class InputBackgroundColorDirective implements OnChanges {
@Input() backgroundColor!: string; @Input() backgroundColor!: string;
@Input() appearance!: string; @Input() appearance!: string;
...@@ -23,9 +21,9 @@ export class InputBackgroundColorDirective implements OnChanges { ...@@ -23,9 +21,9 @@ export class InputBackgroundColorDirective implements OnChanges {
private setBackgroundColor(): void { private setBackgroundColor(): void {
let targetElements: HTMLElement[]; let targetElements: HTMLElement[];
if (this.appearance === 'outline') { if (this.appearance === 'outline') {
targetElements = this.elementRef.nativeElement.querySelector('div.mat-form-field-outline')?.children; targetElements = this.elementRef.nativeElement.querySelector('div.mdc-notched-outline')?.children;
} else { } else {
targetElements = [this.elementRef.nativeElement.querySelector('div.mat-form-field-flex')]; targetElements = [this.elementRef.nativeElement.querySelector('div.mat-mdc-form-field-flex')];
} }
// This fails, when component is not set up yet, therefore the extra check // This fails, when component is not set up yet, therefore the extra check
if (targetElements) { if (targetElements) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment