mardi 26 septembre 2017

When I select Edit it should display the value which is stored in my database In Angularjs

I have Privilege list

<table width="60%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">

        <tr align="center" valign="middle">
        <td width="35" height="35"><strong>ID</strong></td>
        <td><strong>Roles</strong> </td>
        <td><strong>Action</strong></td>
        </tr>

        <tr align="center" valign="middle" ng-repeat="x in privilegename">
        <td width="35" height="35" bgcolor="#FFFFFF"></td>
        <td align="left" bgcolor="#FFFFFF" style="padding-left: 10px;"></td>          
        <td width="250" bgcolor="#FFFFFF">
        <span style="padding-left:5px;">          
        <a class="common-link" href="" ng-click="edit(x)"><i class="fa fa-pencil" aria-hidden="true"></i></a>
        &nbsp;|&nbsp; 
        <a class="common-link" href="" ><i class="fa fa-trash-o text-danger" aria-hidden="true"></i></a>
        </span>
        </td>
        </tr>          
        </table>

And the form to manage privilege it should also act as Edit form. It have one dropdown which consists of privilege name and next one is checklist consists of menus. When user select the edit option in list it should display the value which is stored in database.

Here is my controller for edit function

 $scope.edit = function(x)
       {
        $scope.privilege = x;
        console.log($scope.privilege);
        $scope.submit = "Update";

        $scope.url = "/updateprivilege";
       } 

My checklist in Form :

<tr>
                    <td  height="40" align="left" valign="middle"><span class="head-three">
                    Menus</span></td>
                    <td width="20" align="left" valign="middle">:</td>
                    <td ng-repeat="menu in menulist" class="menu_checklist">
                    <input
                    type="checkbox"
                    name="privilege_menu"
                    value=""
                    ng-model="privilege.privilege_menu"
                    selected
                    ng-click="toggleSelection(menu)"> 
            </td>



            </tr>

For dropdown its working fine. But Checklist is empty.




Aucun commentaire:

Enregistrer un commentaire