Using same page with a list of different types


#1

In my Ionic 2 app, I am showing lists at various stages in the UI and was wondering what would be the right approach to implement/develop. Any suggestions and/or pointers will be highly appreciated.

Following is the scenario:

  • I have a User Detail page (src\pages\user-details) from where the user can be assigned with different permissions (let’s say ‘Assign Permissions’) of a type of account depending on which account the user belongs to. That is, accounts can have multiple levels of permissions.

  • Upon tapping on ‘Assign Permissions’, a page with a list of first level of Permissions is displayed. For example,

Country >
Region >
State >
  • Then the user selects let’s say ‘Region’ (second level of permissions), now a page with the list of Regions will be displayed like:
NorthEast
West
SouthWest
East

In above scenario, considering the levels can go deeper, what would be the right approach to develop such UI?

  • Is it a good idea to create as many pages as there will be levels (the maximum levels can be 10)?

  • Or I should create a reusable list component that will accept an array for each type of list and use this component by pushing the same page but with different contents of list?

  • Is this possible?

  • Will I be able to go back to previous list page?

Thank you!


#2

I would vote for the second option and answer “yes” to both of the questions.


#3

Thanks for the confirmation @rapropos, appreciated! I did implement it as per second option. :slight_smile: