We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Create a new tab

Thread ID:

Created:

Updated:

Platform:

Replies:

130601 May 19,2017 09:55 PM UTC May 23,2017 12:01 PM UTC Angular 1
loading
Tags: ejTab
Sumair Ahmed
Asked On May 19, 2017 09:55 PM UTC

Trying to create a new tab.  I have a tab.component with methods of create tab, that i got from the forums.  Trying to call from another component, but it's complaining about the ComponentFactoryResolver.  Very new to Angular 2.

Any advice?

export class TabComponent {

    
constructor(private resolver: ComponentFactoryResolver) {}

public createNewTab(componentModulePath, tabName, componentInputs) { //rest of code}
}


export class AppComponent {
constructor() {
let TabComponent: test = new TabComponent(); //Can't initialise here, Complains TabControl signature does not match
}
}


Gopi Govindasamy [Syncfusion]
Replied On May 23, 2017 12:01 PM UTC

Hi Sumair,  

We have achieved your requirement for createNewTab called another component in sample page. We have attached code snippet and sample below link.  

Code snippet:  

export class HomeComponent { 
  // tab containers   
  @ViewChild('myTabPanel') gpTabPanel: EJComponents<ej.Tab, any>; 
 
  constructor(private resolver: ComponentFactoryResolver) { 
    this.hiddenTabs = Array<number>(); 
    let a =new TabDataComponent();  
    console.log(a.tab);    // return hello 
  } 
 
  tempTestCounter = 0; 
  onCustomButtonClick(args) { 
    this.tempTestCounter++; 
    this.createNewTab('homeComponent' + this.tempTestCounter, 'test' + this.tempTestCounter, {}); 
  } 
 
 
export class TabDataComponent { 
  public tab:string; 
  constructor() {  
    this.tab = 'hello'; 
 
  } 
} 




Regards, 
Gopi G. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;