Ionic, Typescript & AngularCreate Dynamic User with toggle model


#1

Please can someone give me some insight. I have created a dynamic list of users, each of which is expandable.
(Open and Close content sections to view per users)
Within each user, they have certain permissions targeted by ion-toggle items.

My dilemma, as I am still new to these languages, is to create a model or something, where I create all user permissions before hand, be able to track all changes on the ion-toggle checkbox item and be able to open close each user without loosing toggle change states, with the end goal to update all user toggle options with one click.

This is specifically for mobile as the desktop layout is much different and works with a row and checkboxes.

<span *ngFor=“let djpermission of serviceUserPermissions”>
<button *ngIf=“resourceName = djPermission.UserName”>{{djPermission.UserName}}
<div *ngIf=“djPermission.UserName == resourceName”>


Label Item

I have a function that checks and works out the permission of each dj, returns booleans true or false.

If I understand correct, using a ngModel is a good approach, but struggling a bit to keep each model unique to each user and track toggle changes per user model.

Your help would be much appreciated.


#2

I would suggest going through the Tour of Heroes, as its domain is very similar to what you describe. Your “users” are its “heroes”.