+
+ $scope.createMechidScope = function(editRoleData) {
+ var uuu = "save_NewMechidScopesData";
+ editRoleData.scope = $scope.activeScopes;
+ var postData={editRoleData: editRoleData};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.rolesDatas=data.rolesDatas;});
+ console.log($scope.rolesDatas);
+ $modalInstance.close({rolesDatas:$scope.rolesDatas});
+ },
+ error : function(data) {
+ alert("Error while Creating Mechid scopes.");
+ }
+ });
+ };
+
+
+
+ $scope.addScope = function(scopes) {
+ for (var i = 0; i < scopes.length; i++) {
+ if ($.inArray(scopes[i], $scope.activeScopes) === -1) {
+ $scope.activeScopes.push(scopes[i]);
+ }
+ }
+ };
+ $scope.deleteScope = function(index) {
+ $scope.activeScopes.splice(index, 1);