<code> <ej-tab [showCloseButton]="true" #tabObj> <ul> <li *ngFor="let t of tabs"><a rel='nofollow' href="#{{t}}">Tab {{t}}</a></li> </ul> <div *ngFor="let t of tabs" id="{{t}}" [style.width]="'100%'"> Hello tab {{t}} </div> </ej-tab> <br> <button (click)="onNewTab(tabObj)">Add Item</button> </code> |
<code> export class AppComponent { public tabs=["tab1","tab2"] public count = 2 ; onNewTab(tabObj) { this.count ++ var a = "tab" + this.count; tabObj["widget"]["addItem"]('#'+a,'Tab' + this.count); document.getElementById(a).innerHTML = "Hello tab " + a; } } </code> |
<code> <button (click)="onNewTab(tabtest1)">Add Item</button> </code> |
<code> export class AppComponent { public tabs:any =["tab0","tab1"]; public count:number = 2; public tabObject :any; public triggered:boolean = false; onNewTab(tabtest1) { this.tabs.push("tab"+this.tabs.length); this.count = jQuery(".e-tab").find("li").length; this.tabObject = tabtest1; this.triggered = false; } ngAfterViewChecked(){ if(jQuery(".e-tab").find("li").length > this.count && !this.triggered){ this.tabObject["widget"]["_refresh"](); this.triggered = true; } } } </code> |