당신은 ng-model
에서 하나 개의 객체를 사용하지 않음으로써 별도의 수동 작업을 많이 만들 첫 번째 장소는 개별 범위 속성을 사용하는 대신입니다.
또한 황금률이있다 그 if you don't have a dot in ng-model you are doing it wrong
과 같이 수행 난 강력하게 당신이 jQuery를 없애 제안
$scope.edit = function(terminal) {
// store reference to terminal being edited
$scope.currentTerminal = terminal;
// make a copy so live one is not affected -- will be used in form
$scope.terminal = angular.copy(terminal);
}
$scope.save = function(){
// update stored original with changes
angular.extend($scope.currentTerminal, $scope.terminal);
// reset terminal used in form
$scope.terminal ={};
}
: 다음
<input ng-model="terminal.name">
<input ng-model="terminal.age">
는 다음과 같은 라인을 따라 작동 및 bootstrap.js 및 앵글 - 부트 스트랩 insted 사용
charlietfl, 고맙습니다. PHP로 데이터베이스에 데이터를 저장하는 중입니다. 편집 할 값을 저장하는 새로운 함수가 필요합니까? 또는 확장 메서드를 자동으로합니까? – torresito
하나의 객체를 사용하는 더 많은 이유가 있습니다. '$ http'에 막대기를 넣고보기 버전 만 업데이트하면됩니다. – charlietfl
안녕하세요 charlietfl, ued와 같은 점으로 ngmodel을 시도했지만 클릭하면 수정 버튼을 누른 다음 추가 버튼을 누르면 양식 추가 입력에 값이 있습니다. – torresito