我按如下方式顯示了一個玩家列表,但是當用戶點擊玩家的名字時,我想添加玩家的名字作爲一個類到ng-view
元素,通過路線查看他們的詳細信息。我怎麼能這樣做?將菜單項值作爲一個類添加到ng-view
<tr ng-repeat="player in playersList">
<td>
<a href="#/details/{{player.id)}}">
{{player.name}}
</a>
</td>
查看:
<div class="" ng-view></div>
位指示:
.controller('playersController', function($scope, footballdataAPIservice) {
$scope.playersList = [];
footballdataAPIservice.getPlayers().success(function (response) {
//Dig into the response to get the relevant data
$scope.playersList = response;
});
顯示完整的標記,請 – DonJuwe 2015-02-10 13:22:13
好,我將我的控制器到OP – user1937021 2015-02-10 13:38:10