Как добавить строку динамически, используя AngularJS в таблице, которая содержит данные из запроса на получение?Как добавить строку динамически, используя угловые js в таблице?
Я написал код, например:
<table id="tableRow" class="table table-bordered tableRow">
<thead>
<tr>
<th></th>
<th>
<label>Make</label>
</th>
<th>
<label>Vin</label>
</th>
<th>
<label>Model</label>
</th>
<th>
<label>Parts</label>
</th>
<th>
<label></label>
</th>
<th>
<label></label>
</th>
</tr>
<thead>
</table>
теперь использует угловые JS, как я могу добавить строку по нажатию кнопки или запрос получите в той же таблице ...?
я написал скрипт, который did'nt работать скрипт выглядит следующим образом ..
$scope.myGet = function() {
$http.get("http://172.17.133.82:8080/restproj/v1/dealer")
.then(function(response) {
$scope.addRow = response.data;
var tall = '';
tall += '<tr>'+
'<td><button class="btn btn-danger btn-remove" type="button"><i class="glyphicon glyphicon-trash gs"></i></button</td>' +
'<td><input type="text" class="form-control" id="makeid" ng-model="addRow.make"></td>' +
'<td><input type="text" class="form-control" id="vinid" ng-model="addRow.vin"></td>'+
'<td><input type="text" class="form-control" id="modalid" ng-model="addRow.model"></td>' +
'<td ng-repeat="part in addRow.parts"><input type="text" class="form-control" id="partsid" ng-model="addRow.name"><input type="text" class="form-control" id="partsid" ng-model="addRow.desc"></td>' +
'</tr>';
$('#tableROW').append(tall);
});
я получаю сообщение об ошибке, таких как:
tabelform.html:320 Uncaught SyntaxError: Unexpected end of input
angular.min1.5.9.js:6 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.9/ $injector/modulerr?p0=myApp&p1=Error%3A%2…Ic%20(http%3A%2F%2F127.0.0.1%3A63139%2Fjs%2Fangular.min1.5.9.js%3A21%3A332)(…)
Вы пытаетесь внедрить модуль, который не существует (или ISN» t загружен) в ваше приложение. Попробуйте опубликовать определение вашего приложения/контроллера –
Вам не следует вводить html-код с контроллера (попробуйте сделать это без jQuery) – Endless
как это сделать? в угловом –