Generate dynamic @Page from a JSON containing array of items representing each page


#1

I have been looking for ways to generate ionic2 Pages from a JSON .
structure of the json is simple - {“screens”:[{‘screenName’:“PageOne” , ‘sccreenContent’:‘placeholder-text’} , {‘screenName’:“PageTwo” , ‘sccreenContent’:‘placeholder-text’} … <- dynamic array of screens

tried this appraoches :-
In constructor iterated thru the JSON and used nav.push( TemplateSCreen , {sname: currentItem.screenName ,currentItem.screenContent }) . used the navParams.get(‘sname’) in the TemplateScreen Component

but the problem is it creates and appends all the pages to the nav object …hence wen the app renders its scrolls thru all created pages and halts at the last page.

Basically i have been looking for way to Loop thru those screen objects and then create instances of a custom TemplateScreen component and then push then in nav object… so i can move to next screen on click of ‘Next’ button in each of such dynamically generated sceen.