将 ngTable 行输入数据传递给 ngDialog 输入
Pass ngTable row input data to ngDialog input
>我正在尝试将模型传递给ngDialog模板
可编辑表格
<table ng-table="tableParams" class="table table-bordered table-striped">
<tbody>
<tr ng-repeat="release in releases track by $index">
<td style="width:5%" data-title="'Version'" ng-model="release.version">{{release.version}}</td>
</tr>
</tbody>
</table>
这是打开对话框并调用$scope.edit
<button ng-click="edit(release)" title="Edit" class="btn btn-sm btn-default">
这是 ngDialog 模板的 HTML
<script type="text/ng-template" id="editRelease">
<div class="form-group">
<div class="col-sm-4">
<input type="text" ng-model="release.version" class="form-control" />
</div>
</div>
</script>
这是我的控制器,我正在尝试在其中填充一行
$scope.edit = function (release) {
ngDialog.openConfirm({
template: 'editRelease',
className: 'ngdialog-theme-default',
scope: $scope,
controller: ['$scope', function ($scope) {
$scope.$watch('release', function (passedObject) {
console.log(release.version);
});
}]
})
};
我已经设法从模型中传递对象并将其登录到控制台。当按下编辑按钮时,如何使用表中的文本填充对话框到对话框中?
你需要
使用solve将数据传递给模态:
ngDialog.openConfirm({
template: 'editRelease',
className: 'ngdialog-theme-default',
scope: $scope,
controller: ['$scope','release', function ($scope,release) {
$scope.$watch('release', function (passedObject) {
console.log(release.version);
});
}],
resolve: {
release: function () {
return release;
}
}
})
来源 : https://github.com/likeastore/ngDialog#resolve-objectstring-function
相关文章:
- 为什么不't Javascript对我的输入值进行了一些重新检查
- 可以't让我的if语句处理js中的html表单输入
- 名称输入的索引
- 如何编写HTML输入的JS内联
- 要求输入在数据列表中
- 将输入字段中的文本提交到我的数据库,同时将其添加到我的列表中
- 让文本输入幻灯片显示输入时的新文本输入?然后向后滑动
- 如何将输入(type=text)从html表单传递到javascript函数
- 单击jquery清除输入值
- 而循环只设置php中输入字段中的第一个值
- 在输入字段中将最小金额设置为
- jQuery自定义验证比较多个输入的序列
- Sails.js:同时发布文本输入和一个文件
- 使用javascript检查多个输入值,并在1次检查中标记多个输入框
- 如何在输入字段中的按钮的帮助下打开日历,该字段的类型为“=”;日期”;
- 使用jquery在单击时在单元格中输入值
- Ajax文件加载和<输入>文件加载
- 是否可以将一个函数输入连接到另一个函数调用的文本
- 将值输入到对象,然后该对象推送到数组
- 将 ngTable 行输入数据传递给 ngDialog 输入