fix(form-inputs): show material inputs

This commit is contained in:
Evgeny Lupanov 2020-04-03 17:57:34 +03:00
parent 3527b4f214
commit 8a2b24f7bd
2 changed files with 14 additions and 11 deletions

View file

@ -87,7 +87,7 @@
</nb-card>
</div>
</div>
<div *ngIf="materialTheme$ | async" class="row">
<div *ngIf="showMaterialInputs" class="row">
<div class="col-lg-12">
<ngx-material-inputs></ngx-material-inputs>
</div>

View file

@ -1,25 +1,28 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { tap } from 'rxjs/operators';
@Component({
selector: 'ngx-form-inputs',
styleUrls: ['./form-inputs.component.scss'],
templateUrl: './form-inputs.component.html',
})
export class FormInputsComponent {
export class FormInputsComponent implements OnInit {
public constructor(private readonly themeService: NbThemeService) {
this.materialTheme$ = this.themeService.onThemeChange()
.pipe(map(theme => {
const themeName: string = theme?.name || '';
return themeName.startsWith('material');
}));
}
public readonly materialTheme$: Observable<boolean>;
public materialTheme$: Observable<boolean>;
public starRate: number = 2;
public heartRate: number = 4;
public radioGroupValue: string = 'This is value 2';
public showMaterialInputs = false;
ngOnInit() {
this.materialTheme$ = this.themeService.onThemeChange()
.pipe(tap(theme => {
const themeName: string = theme?.name || '';
this.showMaterialInputs = themeName.startsWith('material');
}));
}
}