Home Display two json in a only form
Reply: 0

Display two json in a only form

A. Bin
1#
A. Bin Published in 2018-02-14 08:50:07Z

how are you?

*I have 2 different json, that has only similar id. I want to display in html all permissions, and checked only permissions from role. Can you suggest me some idea, how to implement this? json 1. like this. Permission in one role "name": "test15",

    {
        "StatusCode": 0,
        "StatusMessage": "OK",
        "StatusDescription": [
            {
         "rolet": [
                        {
                            "procedure_id": 16,
                            "procedure_name": "app_userscreate",
                            "procedure_desc": "create"
                        },
                        {
                            "procedure_id": 17,
                            "procedure_name": "app_usersupdatebyid",
                            "procedure_desc": "update"
                        },
                        {
                            "procedure_id": 18,
                            "procedure_name": "app_usersgetall",
                            "procedure_desc": "getall"
                        },
                        {
                            "procedure_id": 19,
                            "procedure_name": "app_usersgetbyid",
                            "procedure_desc": "getbyid"
                        },
                        {
                            "procedure_id": 20,
                            "procedure_name": "app_usersdeletebyid",
                            "procedure_desc": "delete"
                        }
                    ],
                    "id": 20,
                    "name": "test15",
                    "active": 1,
                    "creation_date": "2018-02-13T13:38:46.000Z"
                }
            ]
    }]

*2. json like this: All permission that I used for create role

    {
        "StatusCode": 0,
        "StatusMessage": "OK",
        "StatusDescription": [
            {
                "permission_id": 16,
                "permissin_desc": "create product"
            },
            {
                "permission_id": 17,
                "permissin_desc": "Update product"
            },
            {
                "permission_id": 18,
                "permissin_desc": "Get all products"
            },
            {
                "permission_id": 19,
                "permissin_desc": "Get only one product"
            },
            {
                "permission_id": 20,
                "permissin_desc": "Delete products"
            }]
    }

my html code

<div class="row">
  <select multiple formControlName="sp_id" id="permission_id" materialize="material_select" [materializeSelectOptions]="permissions"
    [ngClass]="{invalid: invalidInputs}">
    <option value="" disabled selected>Select Permissions</option>
    <option *ngFor="let permission of permissions" [value]="permission.permission_id">{{permission.permissin_desc}}</option>
  </select>
</div>

my ts code: In this code I populate

  populateFormRole() {
    this.activatedRoute.params.subscribe(
      params => {
        this.ws.getRoleById(params['id']).subscribe(
          role => {
            this.role = role;
            this.editRoleForm.controls['name'].setValue(role.name);
            this.editRoleForm.controls['active'].setValue(role.active);
            this.editRoleForm.controls['sp_id'].patchValue([role.procedure_id]);
          }
        )
      }
    );
  }

Thanks in advance

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.377809 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO