主列表页面具有编辑按钮。其中打开编辑行的详细信息。
Way-1:现在,如果我设置了“ctrl.parent.q_details.client_location”,它将与父级列表控制器绑定,并且它作为双向绑定工具并自动更改值,如同在编辑框更改中那样这里没有要求。
这里只是我想要显示并允许在inputbox中编辑值。不想在父控制器中更改。
将数据传递给mdDialog
►以下是在父控制器的代码来调用mdDialog
$mdDialog.show({
locals:{parent: $scope},
clickOutsideToClose: true,
controllerAs: 'ctrl',
templateUrl: 'quotation/edit/',//+edit_id,
controller: function() { this.parent = $scope; },
});
►以下是弹出mdDialog的代码。
<md-dialog aria-label="">
<div ng-app="inputBasicDemo" ng-controller="deliverController" layout="column">
<form name="" class="internal_note_cont">
<md-content class="md-padding">
<md-input-container class="md-input-has-value" flex>
<label>Client Name</label>
<input ng-model="qe.client_name" required >
</md-input-container>
<md-input-container flex>
<label>Client Location</label>
<input required ng-model="ctrl.parent.q_details.client_location">
</md-input-container>
</md-content>
</form>
<div>
</div>
</div>
<input type="" required ng-model="ctrl.parent.q_details.recid">
</md-dialog>
Way2:秒方式直接从DB发送的值而不结合NG-模型对话框控制器(deliverController)的。
]).controller("deliverController", ["$scope", "$filter","$http","$route","$window","$mdDialog",
function ($scope, $filter,$http,$route,$window,$mdDialog) {
$scope.qe.client_name = '12345'; // just to test.
}
这是给取消定义$ scope.qe的错误。
因此,最终,我无法将数据发送到mdDialogue并显示它们,并允许以正常方式编辑它们。 请任何人有经验的角人帮助我。我对角度很陌生。 自2天以来,我尝试了不同的方法。
您可以使用ng-bind设置一次性绑定。您也可以通过服务在父母和孩子之间传递数据。 – BobDoleForPresident
你尝试过'preserveScope:true'吗? – Ellone