Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度模态文本框未填充ngModel_Javascript_Angularjs_Modal Dialog_Ngmodel - Fatal编程技术网

Javascript 角度模态文本框未填充ngModel

Javascript 角度模态文本框未填充ngModel,javascript,angularjs,modal-dialog,ngmodel,Javascript,Angularjs,Modal Dialog,Ngmodel,我有一张桌子,上面有电视节目的数据。我用dir paginate/ng repeat填充表格,我可以单击一行打开一个模式以编辑显示,但ng模型数据没有加载到该模式内的文本框中 <tr id='schedule_row' class='hover_click_cell' dir-paginate='tv_show in tv_shows | orderBy:sortType:sortReverse | itemsPerPage:10'> <td class='center_tex

我有一张桌子,上面有电视节目的数据。我用
dir paginate/ng repeat
填充表格,我可以单击一行打开一个模式以编辑显示,但ng模型数据没有加载到该模式内的文本框中

<tr id='schedule_row' class='hover_click_cell' dir-paginate='tv_show in tv_shows | orderBy:sortType:sortReverse | itemsPerPage:10'>
<td class='center_text clickable_cell cell_width' ng-click='alter_show(tv_show)'>{{tv_show.show_name}}</td>
以JSON格式传递的数据如下所示:

{"watched":false,"id":1,"show_name":"The Walking Dead","season":1,"episode":1,"season_episode":"Season 1, Episode 1","$$hashKey":"object:4"}
我传入show details并将其设置为
$scope.edit\u show
对象。传递的数据不是空的,但打开模式时,文本框不会填充。以下是输入框:

$scope.edit_show = {
    show_name: '',
    season: 0,
    episode: 0,
    watched: 0
};

<div class='form-group'>
<label for='show_name'>Show Name:</label>
<input type='text' class='form-control' id='edit_show_name' ng-model='edit_show.show_name'>
</div>

<div class='form-group'>
<label for='season'>Season:</label>
<input type='number' class='form-control' id='edit_season' ng-model='edit_show.season'>
</div>
$scope.edit\u show={
显示\u名称:“”,
季节:0,
插曲:0,,
观看人数:0
};
显示名称:
季节:

我如何才能让它在文本框中填充已单击行的详细信息?

我已通过使用modalInstance的resolve找到了答案

$scope.alter_show = function(show)
{
    var modalInstance = $uibModal.open    ({    animation: $controller.animationsEnabled,
                                                ariaLabelledBy: 'modal-title',
                                                ariaDescribedBy: 'modal-body',
                                                templateUrl: 'edit_tv_show.html',
                                                controller: 'EditTvShowCtrl',
                                                controllerAs: '$controller',
                                                size: 'sm',
                                                backdrop: 'static',
                                                keyboard: false,
                                                resolve: { tv_show : function() { return show; } }
                                        });

    modalInstance.result.then(function (action) 
    {

    }, 
    function () {
    });
}

angular.module('ui.bootstrap').controller('EditTvShowCtrl', function ($uibModalInstance, $scope, tv_show) 
{
    var $controller = this;

    $scope.edit = tv_show;
});

文本框未填充或值未绑定?
$scope.alter_show = function(show)
{
    var modalInstance = $uibModal.open    ({    animation: $controller.animationsEnabled,
                                                ariaLabelledBy: 'modal-title',
                                                ariaDescribedBy: 'modal-body',
                                                templateUrl: 'edit_tv_show.html',
                                                controller: 'EditTvShowCtrl',
                                                controllerAs: '$controller',
                                                size: 'sm',
                                                backdrop: 'static',
                                                keyboard: false,
                                                resolve: { tv_show : function() { return show; } }
                                        });

    modalInstance.result.then(function (action) 
    {

    }, 
    function () {
    });
}

angular.module('ui.bootstrap').controller('EditTvShowCtrl', function ($uibModalInstance, $scope, tv_show) 
{
    var $controller = this;

    $scope.edit = tv_show;
});