Skip to content
Snippets Groups Projects
dropdown.component.ts 1.25 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { Component } from '@angular/core';
    
    import { DropdownElement } from '../unit';
    import { FormElementComponent } from '../form-element-component.directive';
    
    
    @Component({
      selector: 'app-dropdown',
      template: `
    
    rhenck's avatar
    rhenck committed
          <mat-form-field appearance="fill"
    
                          [style.width.%]="100"
                          [style.height.%]="100"
    
    rhenck's avatar
    rhenck committed
                          [style.background-color]="elementModel.backgroundColor">
              <mat-label [style.color]="elementModel.fontColor"
                         [style.font-family]="elementModel.font"
                         [style.font-size.px]="elementModel.fontSize"
                         [style.font-weight]="elementModel.bold ? 'bold' : ''"
                         [style.font-style]="elementModel.italic ? 'italic' : ''"
                         [style.text-decoration]="elementModel.underline ? 'underline' : ''">
    
                  {{$any(elementModel).label}}
    
    rhenck's avatar
    rhenck committed
              </mat-label>
    
              <mat-select [formControl]="elementFormControl">
    
                  <mat-option *ngFor="let option of elementModel.options" [value]="option">
    
                      {{option}}
                  </mat-option>
              </mat-select>
          </mat-form-field>
    
    export class DropdownComponent extends FormElementComponent {
      elementModel!: DropdownElement;
    }