src/app/shared/view-header/view-header.component.ts
changeDetection | ChangeDetectionStrategy.OnPush |
selector | app-view-header |
styleUrls | view-header.component.scss |
templateUrl | ./view-header.component.html |
Methods |
Inputs |
Outputs |
constructor()
|
viewList
|
Type: |
viewChanged
|
$event type: EventEmitter<string>
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
import {
ChangeDetectionStrategy,
Component,
EventEmitter,
Input,
OnInit,
Output
} from '@angular/core';
@Component({
selector: 'app-view-header',
templateUrl: './view-header.component.html',
styleUrls: ['./view-header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ViewHeaderComponent implements OnInit {
@Input()
viewList: Array<string>;
@Output()
viewChanged: EventEmitter<string> = new EventEmitter();
constructor() { }
ngOnInit() {
}
}
<md-tab-group>
<md-tab *ngFor="let view of viewList">
<ng-template md-tab-label>
<div (click)="viewChanged.emit(view)">
{{ view | capitals }}
</div>
</ng-template>
</md-tab>
</md-tab-group>