2
У меня есть таблица с устройствами, и на каждой строке у меня есть опция отключения устройства. Когда я отключить одно устройство, все работает отлично, но когда я wan't отключиться второе устройство, я получаю следующую ошибку TypeError: v2.disconnectDevice is not a function
ТипError: v2.disconnectDevice не является функцией (угловой)
Это мой контроллер
.controller('subscriber', ['$scope', '$routeParams', 'userEndPointService', function($scope, $routeParams, userEndPointService){
//Disconnect device
$scope.disconnectDevice = false;
$scope.disconnectDevice = function(deviceUid, $index){
var c = confirm("U sure?");
if (c == true) {
userEndPointService.method("disconnectDevice", {"deviceUid" : deviceUid}).then(function(){
$scope.disconnectDevice = true;
$scope.subDevice.splice($index, 1);
});
}
}
}])
И это мой HTML таблице:
<table class="table table-bordered table-hover dataTable" >
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending">Device type</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">Device UID</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending">Device provisioning date</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">Video type</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Postal code: activate to sort column ascending">Region</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Post: activate to sort column ascending">Disconect</th>
</tr>
</thead>
<tbody>
<tr role="row" class="odd" ng-repeat="row in subDevice track by $index">
<td>{{row.deviceTypeDesc}}</td>
<td>{{row.deviceUid}}</td>
<td>{{row.deviceProvisioningDate}}</td>
<td>{{row.videoTypeDesc}}</td>
<td>{{row.regionName}}</td>
<td><button class="btn btn-block btn-info btn-flat" ng-click="disconnectDevice(row.deviceUid, $index)">Disconnect</button></td>
</tr>
</tbody>
</table>
Что я делаю неправильно?
Thx DrYuri, вы спасли мой день! –