首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular-ui-bootstrap模式不显示传递给它的数据

Angular-ui-bootstrap模式不显示传递给它的数据
EN

Stack Overflow用户
提问于 2016-09-16 02:54:21
回答 1查看 798关注 0票数 0

当模式窗口打开时,我试图将一些模型数据传递到模式窗口中。它有成功的$http.post,也有失败的then(),有一些不同的标题和按钮文本。我将多个数据传递给它,如下所示:

代码语言:javascript
复制
//.then(){...//same as below }
,function (response){
     $scope.PostRespData = response.data.message || 'Rq Failed';

     $scope.pn = $scope.PostRespData.substring(53,63);

     //(status=400) response modal string
     $scope.name = 'Hey there!';

     //modal options
     $scope.opts = {
                backdrop: true,
                backdropClick: true,
                dialogFade: false,
                keyboard: true,
                templateUrl : 'alreadyexists.html',
                controller : ModalInstanceCtrl,
                resolve: {}
                };


    $scope.opts.resolve.item = function() {
                   return angular.copy({name:$scope.name, errmsg:$scope.PostRespData, num:$scope.pn}); // pass name to modal dialo
                        }

     //open the modal and create a modal Isntance
     var modalInstance = $uibModal.open($scope.opts);

     var ModalInstanceCtrl = function($scope, $uibModalInstance, $uibModal, item) {

          $scope.item = item;

          $scope.ok = function () {
          $uibModalInstance.close();

          };

          $scope.cancel = function () {
          $uibModalInstance.close();
                        }

我的HTML模板如下所示

代码语言:javascript
复制
<div class="modal-header">
  <h1>{{item.name}}</h1>
</div>
<div ng-controller="Nav" class="modal-body">
<p>{{item.errmsg}}
    <a href="http://myserver.com/page.jsp?num="+{{item.num}}+"&c=y">View {{item.num}}</a>
</p>
</div>
<div class="modal-footer">
  <button class="btn btn-primary" ng-click="ok()">Edit Current Details</button>
<button class="btn btn-warning" ng-click="cancel()">Edit {{item.num}}</button>
</div>

我得到了我的模型,我也得到了静态数据,但传递给它的数据并没有反映出来。我花了一整天的时间试着把它做好。

编辑:添加当前输出图片。

请帮帮我!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-16 04:54:57

正如@charlietfl所指出的,这是一个悬而未决的问题。要使用上面的代码,将var ModalInstanceCtrl = func..移到按钮的$httpng-click调用之外。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39518406

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档