Я использую угловые 7. вкладки primeng tab Нажмите на компонент, который я хочу изменить.но я не мог.Не могли бы вы помочь?
У меня есть 3 компонента.Во-первых, компонент будет работать по умолчанию.Затем я хочу изменить компоненты, когда нажимаю на панель внутри вкладки.
Я пытаюсь запустить функции с onchange на машинописном наборе, но функции не вызываются.
есть ли другиеспособ запуска функций?
Спасибо.
.ts код:
import { Component, OnInit} from '@angular/core';
@Component({
selector: 'jhi-component-example',
templateUrl: './component-example.component.html',
styleUrls: ['./component-example.scss']
})
export class ComponentExample implements OnInit {
id: number;
constructor() { }
ngOnInit() {
this.id = 1;
}
func1() {
this.id = 1;
}
func2() {
this.id = 2;
}
func3() {
this.id = 3;
}
}
.html код:
<div class="global-div">
<div class="div1-example">
<p-tabView >
<p-tabPanel (onChange)="func1()" header="Component1" >
</p-tabPanel>
<p-tabPanel (onChange)="func2()" header="Component2">
</p-tabPanel>
<p-tabPanel (onChange)="func3()" header="Component3">
</p-tabPanel>
</p-tabView>
</div>
<div class="div2-example">
<p *ngIf="id==1">
<jhi-component1></jhi-component1>
</p>
<p *ngIf="id==2">
<jhi-component2></jhi-component2>
</p>
<p *ngIf="id==3">
<jhi-component3></jhi-component3>
</p>
</div>
</div>