5
특정 사용자에 대한 정보를 작성하기 위해 리피터를 사용하는 정보 화면이 있습니다.AngularJS - 객체 데이터를 모달로 전달
"편집"버튼을 클릭하면 어떻게 특정 사용자 객체 데이터를 모달 창 템플릿으로 전달할 수 있습니까?
HTML
<form class="custom" ng-controller="DepCtrl" ng-cloak class="ng-cloak">
<fieldset ng-repeat="object in data.dataset">
<legend><span>{{ object.header }}</span><span class="dep_rel">({{ object.relation }}) </span></legend>
<div class="row">
<div class="four columns" ng-repeat="o in object.collection.inputs">
<span class="table_label">{{ o.label }}:</span><span class="table_answer">{{ o.value }}</span><br>
</div>
</div>
<div class="row">
<a ng-click="openDialog('edit')" style="color:#444;text-decoration:none;margin-right:10px;margin-top:5px;" class="btn_gray smaller left" href="#">Edit</a>
<a style="color:#444;text-decoration:none;margin-top:5px;" class="btn_gray smaller" href="#">Delete</a>
</div>
</fieldset>
</form>
JS 그것은 $ 대화 상자가 핵심 AngularJS와 API의 일부가 아니기 때문에, 정확히 언급하는 대화 서비스를 $ 알고하는 데 도움이
function DepCtrl($scope, Dependents, $dialog) {
$scope.data = Dependents;
var t = '<div class="modal-header">'+
'<h3>' + $scope.header.value + '</h3>'+
'</div>'+
'<div class="modal-body">'+
'<p>Enter a value to pass to <code>close</code> as the result: <input ng-model="result" /></p>'+
'</div>'+
'<div class="modal-footer">'+
'<button ng-click="close(result)" class="btn btn-primary" >Close</button>'+
'</div>';
$scope.opts = {
backdrop: true,
keyboard: true,
dialogFade: true,
backdropClick: false,
template: t, // OR: templateUrl: 'path/to/view.html',
controller: 'TestDialogController'
};
$scope.openDialog = function(action){
var d = $dialog.dialog($scope.opts);
//if (action === 'edit') { $scope.opts.templateUrl = '../../modal.html'; }
d.open().then(function(result){
if(result)
{
alert('dialog closed with result: ' + result);
}
});
};
}
로 컨트롤러에 전달됩니다 구성원 $dialog documentation으로
그것을 말한다? 나는 대화 상자가 열리지 않을 것이라고 생각하지만, 그 경우에는 거부 된 약속을 처리하는 방법에 대한 우리의 맞춤 코드를 실행할 수 있습니까? 예를 들면 : 건배를 보여 주거나. – vivek