fixed compatibility for Chrome on clicking select options.

This commit is contained in:
kunw 2016-04-22 12:32:24 +08:00
parent 5187c7e1dc
commit 224fb808eb
4 changed files with 11 additions and 13 deletions

View File

@ -1,6 +1,5 @@
<ng-switch on="vm.editMode">
<span ng-switch-default>//vm.currentRole.name//</span>
<select ng-switch-when="true">
<option value="//role.id//" ng-selected="//role.id == vm.currentRole.id//" ng-click="vm.selectRole(role)" ng-repeat="role in vm.roles">//role.name//</option>
<select ng-switch-when="true" ng-model="vm.currentRole" ng-options="role as role.name for role in vm.roles track by role.id" ng-click="vm.selectRole(vm.currentRole)">
</select>
</ng-switch>

View File

@ -7,17 +7,16 @@
.directive('switchRoles', switchRoles);
SwitchRolesController.$inject = [];
SwitchRolesController.$inject = ['$scope'];
function SwitchRolesController() {
function SwitchRolesController($scope) {
var vm = this;
vm.currentRole = getRoleById(vm.roleId);
vm.currentRole = getRoleById(vm.roleId);
vm.selectRole = selectRole;
function selectRole(role) {
vm.roleId = role.id;
vm.currentRole = getRoleById(vm.roleId);
vm.currentRole = getRoleById(role.id);
}
function getRoleById(roleId) {

View File

@ -1,7 +1,7 @@
<td style="padding: 15px;">//vm.username//</td>
<td><switch-roles roles="vm.roles" edit-mode="vm.editMode" user-id="vm.userId" role-id="vm.roleId"></switch-roles></td>
<td>
<a href="javascript:;" ng-click="vm.update({roleId: vm.roleId})">
<a href="javascript:void(0);" ng-click="vm.update({roleId: vm.roleId})">
<span ng-if="!vm.editMode" class="glyphicon glyphicon-pencil"></span><span ng-if="vm.editMode" class="glyphicon glyphicon-ok"></span>
</ng-switch>
</a>

View File

@ -15,22 +15,22 @@
];
}
EditProjectMemberController.$inject = ['roles', 'EditProjectMemberService'];
EditProjectMemberController.$inject = ['roles', 'EditProjectMemberService', '$scope'];
function EditProjectMemberController(roles, EditProjectMemberService) {
function EditProjectMemberController(roles, EditProjectMemberService, $scope) {
var vm = this;
vm.roles = roles();
vm.editMode = false;
vm.update = update;
function update(e) {
if(vm.editMode) {
vm.editMode = false;
vm.editMode = false;
}else {
vm.editMode = true;
}
}
}
function editProjectMember() {