내 데이터 테이블에서 특정 데이터를 편집하기위한 부트 스트랩 모달을 만들었습니다. 팝업을 열 수 있고 내 데이터를 가져올 수도 있지만 모달의 텍스트 상자에서 일부 변경을 수행하는 중 갑자기 데이터 테이블에 반영됩니다 (데이터 테이블은 다른 컨트롤러에 있음).부트 스트랩 모달 및 각도로 편집
업데이트 버튼을 클릭 한 경우에만 데이터 테이블에 반영하고 싶습니다. 그리고 버튼을 클릭하면 버튼을 취소하고 이전 값이 있어야합니다. 사람이 어디 나를 알게하십시오, 그래서
app.controller('networkModeCtrl', function($rootScope, $scope, $state, networkModeService, $modal, $timeout){
$scope.openModal = function(mac){
var modalInstance = $modal.open({
templateUrl: 'partials/settings/macAddressEdit.html',
controller: 'macAddressEditCtrl',
controllerAs: 'vm',
scope: $scope,
resolve: {
mac: function() { return mac}
}
});
}
});
app.controller('macAddressEditCtrl', function($scope, $state, $stateParams, $modalInstance, mac, networkModeService, indexService){
$scope.mac = mac;
// === Get Mac address filter mode (allow/Deny) list === //
networkModeService.denyAllow().success(function(result){
$scope.denyAllow = result;
});
// === function to save mac staus ===//
$scope.ok = function(mac) {
$modalInstance.close();
};
// === function to cancel model === //
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
});
:
여기<div class="modal-header bg-color">
<h3 class="modal-title">Edit</h3>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-2">
MacAddress
</div>
<div class="col-md-10">:
<input type="text" ng-model="mac.macAddress" name="macAddress" >
</div>
</div>
<br>
<div class="row">
<div class="col-md-2">
status
</div>
<div class="col-md-10">:
<select type="text" ng-model="mac.status" name="macAddress" >
<option ng-repeat="p in denyAllow">{{p}}</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success" ng-click="ok(mac)"> Save </button>
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
</div>
이 AngularJS와 코드입니다 : 여기
<tr ng-repeat="Filterlist in macAddressListResult" class="text-center">
<td>{{1+$index}}</td>
<td class="padding-top-8">
<span class="label" >{{Filterlist.status}}</span>
</td>
<td><span>{{Filterlist.macAddress}}</span></td>
<td>
<button ng-click="openModal(Filterlist)" class="btn btn-xs btn-primary" title="Edit">
<i class="glyphicon glyphicon-edit"></i>
</button>
<button class="btn btn-xs btn-danger" title="Delete">
<i class="glyphicon glyphicon-trash"></i>
</button>
</td>
</tr>
가 모달 HTML 코드입니다 : 여기
내 HTML 코드입니다 잘못 가고있어 !!! 미리 감사드립니다.
답변 해 주셔서 감사합니다. 하지만 첫 번째 옵션은 불가능하며 두 번째 옵션은 작동하지 않습니다. – PiyaModi