components/content/content.component.ts
Main content for dynamic hazard compare applications with tabs:
selector | app-content |
imports |
MatTabGroup
MatTab
MatTabContent
PlotsComponent
HazardDataComponent
SpectraDataComponent
|
templateUrl | ./content.component.html |
styleUrl | ./content.component.scss |
Properties |
constructor(service: AppService)
|
||||||
Defined in components/content/content.component.ts:37
|
||||||
Parameters :
|
hasData |
Default value : computed(() => {
const {modelA, modelB} = this.service.serviceResponses();
return (
modelA?.hazardResponse !== undefined &&
modelB?.hazardResponse !== undefined
);
})
|
Defined in components/content/content.component.ts:30
|
Whether there is data |
import {Component, computed} from '@angular/core';
import {MatTab, MatTabContent, MatTabGroup} from '@angular/material/tabs';
import {AppService} from '../../services/app.service';
import {HazardDataComponent} from '../hazard-data/hazard-data.component';
import {PlotsComponent} from '../plots/plots.component';
import {SpectraDataComponent} from '../spectra-data/spectra-data.component';
/**
* Main content for dynamic hazard compare applications with tabs:
* - Plots tab: show dynamic hazard compare plots
* - Hazard data tab: table of hazard data
* - Spectra data tab: table of spectra data
*/
@Component({
imports: [
MatTabGroup,
MatTab,
MatTabContent,
PlotsComponent,
HazardDataComponent,
SpectraDataComponent,
],
selector: 'app-content',
styleUrl: './content.component.scss',
templateUrl: './content.component.html',
})
export class ContentComponent {
/** Whether there is data */
hasData = computed(() => {
const {modelA, modelB} = this.service.serviceResponses();
return (
modelA?.hazardResponse !== undefined &&
modelB?.hazardResponse !== undefined
);
});
constructor(private service: AppService) {}
}
<mat-tab-group class="height-full">
<!-- Plot tab -->
<mat-tab label="Plots">
<ng-template matTabContent>
<app-plots />
</ng-template>
</mat-tab>
<!-- Data tab -->
<mat-tab label="Hazard Curve Data" [disabled]="hasData() === false">
<ng-template matTabContent>
<app-hazard-data />
</ng-template>
</mat-tab>
<!-- Spectra tab -->
<mat-tab label="Response Spectrum Data" [disabled]="hasData() === false">
<ng-template matTabContent>
<app-spectra-data />
</ng-template>
</mat-tab>
</mat-tab-group>