我有一个表格,其中填充了表格中的信息。当我的记录有一个或多个角色时,它会按预期显示,但是我无法添加其他角色,如果没有角色,我也无法向记录添加任何角色。我的 $add() 函数有问题。
另一个问题是密码和确认密码显示相同的数据。我现在也在努力解决这个问题。
<form ng-model="current">
<fieldset>
<legend>
<a href="" alt="Register" class="btn btn-mini btn-success" ng-click="newItem()"><i
class="icon-plus-sign icon-white"></i> New </a>
Detail
</legend>
<label>First Name</label>
<input type="text" placeholder="First Name" ng-model="current.firstName" value="current.firstName"
ng-disabled="isKey('lastName')">
<label>Last Name</label>
<input type="text" placeholder="First Name" ng-model="current.lastName" value="current.lastName"
ng-disabled="isKey('firstName')">
<label>Email</label>
<input type="text" placeholder="user@example.com" ng-model="current.email" value="current.email"
ng-disabled="isKey('email')">
<label>Password</label>
<input type="password" placeholder="Password" ng-model="current.password" value="current.Pass"
ng-disabled="isKey('Pass')">
<label>Confirm Password</label>
<input type="password" placeholder="Confirm Password" ng-model="current.password" value="current.Pass"
ng-disabled="isKey('Pass')">
<label>Enabled</label>
<select ng-model="current.enabled" ng-disabled="isKey('enabled')">
<option value=true>Enabled</option>
<option value=false>Disabled</option>
</select>
<div class="role" ng-repeat="role in current.roles">
<label>User Roles</label>
<select ng-model="role.roleName" ng-disabled="isKey('role')">
<option value="ROLE_USER">User</option>
<option value="ROLE_ADMIN">Administrator</option>
</select>
</div>
<label></label>
<a class="btn btn-primary" ng:click="current.role.$add()">Add Role</a>
<label></label>
<a href="#askCreateUser" alt="Register" role="button" class="btn btn-success" data-toggle="modal"
ng-click="setDataOperation('Update')"><i class="icon-edit icon-white"></i> Update </a>
<a href="#askCreateUser" alt="Register" role="button" class="btn btn-warning" data-toggle="modal"
ng-click="setDataOperation('Delete')"><i class="icon-trash icon-white"></i> Delete </a>
</fieldset>
</form>