Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic tabs.. #1

Open
msalehisedeh opened this issue Jul 4, 2018 · 0 comments
Open

Dynamic tabs.. #1

msalehisedeh opened this issue Jul 4, 2018 · 0 comments

Comments

@msalehisedeh
Copy link
Owner

Lets say you have a set of tabs you want to display but the tabs are direct result of a response you have from a remote http get request or a database fetch.. in this case the list of tabs you have will be available at a later time. Therefore, in order to display tabs correctly, you have two options.

    1. use "ngIf" on "flexible-tabs" tag,
    1. call "ngAfterContentInit()" method on "FlexibleTabsComponent" host component when you set the list items.
<flexible-tabs position="right" type="button" message="click to select tab "  *ngIf="myDynamicList && myDynamicList.length" (onchange)="ontabselection($event)">
  <flexible-tab *ngFor="let item of  myDynamicList, let x = index" [title]="item.name">
    <h3> information {{x}}</h3>
    This is a simple tab content that will be rendered immediately even if tab is not selected.  
  </flexible-tab>
</flexible-tabs>

OR

<flexible-tabs #myFlexibleTab

and in your typescript file
@ChildView("myFlexibleTab")
myFlexibleTab: FlexibleTabsComponent;

myFetchResopnseMethod() {
 this.myService.getMyTabsList(triggeringId).subscribe(
   (success) => {
      myFlexibleTab.tabs = success.body; 
      myFlexibleTab.ngAfterContentInit();
});

However, if some of the tabs are dynamic and some are predefined, then Only option 1 will bare result for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant