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.
Unfortunately, activation email could not send to your email. Please try again.

Create a new tab

Thread ID:

Created:

Updated:

Platform:

Replies:

130601 May 19,2017 05:55 PM May 23,2017 08:01 AM Angular 1
loading
Tags: ejTab
Sumair Ahmed
Asked On May 19, 2017 05:55 PM

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 08:01 AM

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.

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.

;