gpt4 book ai didi

javascript - 从 ngDialog 返回值

转载 作者:行者123 更新时间:2023-11-30 21:11:12 24 4
gpt4 key购买 nike

我正在使用 ngDialog。出于某种原因,当我单击“关闭”时,closePromise 数据参数不会返回“Vacancy”对象,而是返回值未定义。

请告知如何将值从我的对话框返回到我的调用 Controller 。下面是我的代码:

<script type="text/ng-template" id="firstDialogId">
<div class="ngdialog-message">

<h3>Pick a School</h3>
<div class="form-group">
<md-input-container class="md-block" >
<md-select ng-model="Vacancy" placeholder="Select a Vacancy" id="Md-select2" name="vacancy2" >
<md-option ng-value="vac" ng-repeat="vac in vacancylist" >{{vac.JobTitle}}</md-option>
</md-select>
</md-input-container>
</div>
</div>

<div class="ngdialog-buttons">
<button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="closeThisDialog(Vacancy)">Ok</button>
</div>

$scope.clickToOpen = function () {
var dialog = ngDialog.open({
template: 'firstDialogId',
className: 'ngdialog-theme-default',
showClose: false,
closeByEscape: false,
width: '40%',
closeByDocument: false,
//data: { parentDialogModel: $scope.vacancylist }
scope: $scope
}).closePromise.then(function (data) {
if (data.value && data.value != '$document') {
notification.show('success', 'Password was updated.');
}
else {
notification.show('info', 'Password was not updated.');
}

return true;
});

最佳答案

我缺少下面的值属性:

   <button type="button" class="ngdialog-button ngdialog-button-primary" value="OK" ng-click="closeThisDialog(Vacancy)">Ok</button>

关于javascript - 从 ngDialog 返回值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46119212/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com