У меня есть таблица с данными телешоу. Я заполняю таблицу 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>
При нажатии вызывает функцию alter_show()
$scope.alter_show = function(show)
{
$scope.edit_show = 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
});
modalInstance.result.then(function (action)
{
},
function () {
});
}
Передаваемые данные в формате JSON выглядят следующим образом:
{"watched":false,"id":1,"show_name":"The Walking Dead","season":1,"episode":1,"season_episode":"Season 1, Episode 1","$$hashKey":"object:4"}
Я передаю детали шоу и устанавливаю их для объекта $scope.edit_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>
Как я могу заставить это заполнить текстовое поле деталями из строки, по которой щелкнули?