Im對於angular來說相當新穎,並且能夠稍微得到解決。但我似乎無法找到這種情況下的答案...
我有一個對象數組,我從firebase下拉。我正在使用ng-repeat作爲對象,然後相應地顯示數據。我試圖將索引作爲routeparam傳遞給「編輯」控制器。在這種情況下,我希望按照人們預期的方式提取對象數據。但是,當我篩選ng-repeat時,我得到了過濾內容的索引。我在哪裏找錯了真正的索引?
.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider
.when('/profiles/:index', {
templateUrl: '../views/profile.html',
controller: 'profileCtrl'
});
路徑的正上方,控制器低於
.controller('profileCtrl', function($scope, $routeParams){
$scope.teamProfile = $scope.ourTeam[$routeParams.index];
$scope.index = $routeParams.index;
});
最後的HTML代碼段從重複內。
<div class="profileName"><a href="/profiles/{{$index}}">{{member.name}}</a><span class="handle">{{member.handle}}</span></div>
您的意思是'{} {指數}'而不是'{{$指數}}'? – elclanrs