ionic framework - Dynamic number of tabs using ionic2-super-tabs tag -
i not have fixed number of tabs in app page, using *ngfor in ionic2-super-tabs tag dynamic tabs mentioned in below ts , html.
typescript :
import { australiapage } './australia'; import {canadapage} './canada'; export class countrypage { australia = australiapage; canada= canadapage; tabsloaded = false; ionviewdidload() { this.testservice.getcoutrynames().subscribe(countries => { this.tabs = countries; // below output data of getcoutrynames() method // "countries": [ // { // "country_id": 1, // "countryname": "canada" // }, // { // "country_id": 2, // "countryname": "australia" // } // ] this.tabsloaded = true; }) } }
html :
<super-tabs scrolltabs="true" *ngif="tabsloaded"> <super-tab *ngfor="let tab of tabs" [root]="tab.countryname" title="tab.countryname"></super-tab> </super-tabs>
but getting below error.
runtime error uncaught (in promise): invalid link: australia
any appreciated.
you setting root string 'australia'
not australia
object/page. this:
pages = { australia: australiapage, canada: canadapage, ... }; <super-tabs scrolltabs="true" *ngif="tabsloaded"> <super-tab *ngfor="let tab of tabs" [root]="pages[tab.countryname]" title="tab.countryname"></super-tab> </super-tabs>
Comments
Post a Comment