我有一个这样的表格:
<form name="form.ProjectForm" ng-submit="setProject()" >
<label for="titre">Titre du projet</label>
<input type="text" class="form-control" id="titre" placeholder="Titre" ng-model="project.name" restrict access="guest">
<div class="horizontal-scroll" ng-controller="SmartTableController">
<table class="table" st-table="displayedData" st-safe-src="smartTableData" >
<thead>
<tr class="sortable ">
<th class="table-id" st-sort="id" st-sort-default="true">#</th>
<th st-sort="firstname">Prénom</th>
</tr>
<tr>
<th></th>
<th><input st-search="firstname" placeholder="Chercher Prénom" class="input-sm form-control search-input"
type="search"/></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in displayedData">
<td class="table-id">{{item.id}}</td>
<td>{{item.firstname}}</td>
<td><label class="checkbox-inline custom-checkbox nowrap">
<input id="checkbox" type="checkbox" ng-change="Selected(item.id,checkStatus)" ng-model='checkStatus' />
</label>
</td>
</tr>
</tbody>
</table>
</div>
</form>
在我的项目控制器:
中 $scope.Selected= function(selectedId, checkStatus){
if(checkStatus == false) {
var index = $scope.selectedUsers.indexOf(selectedId);
$scope.selectedUsers.splice(index, 1);
}else{
$scope.selectedUsers.push(selectedId);
}
};
这是我的州定义:
.state('projects', {
url: '/projects',
template : '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
abstract: true,
title: 'Les projets',
controller : 'ProjectController',
controllerAs : 'pCtrl',
sidebarMeta: {
icon: 'ion-compose',
order: 250,
},
})
.state('projects.add', {
url: '/add',
templateUrl: 'http://localhost:8080/gestionprojet/projects',
title: 'Ajouter un projet',
sidebarMeta: {
order: 800,
},
})
但是没有调用$scope.Selected
函数。我尝试过控制器,但它也不起作用。
任何帮助将不胜感激,谢谢。