demoApp
.controller('DetailController', function($http, $scope, $routeParams) {
$http({
method: 'POST',
url: 'Webservice.asmx/getRecord',
data: {}
}).success(function(data) {
$scope.items = data.d[$routeParams.ID - 1];
console.log($scope.items);
});
});
为什么我的控制器在使用$routeParams
时不会在其视图上显示其数据,但是当我从代码中删除数据时,数据显示正确。不幸的是,我没有对这种情况进行过滤。
这就是我如何调用$ scope.items
<tr id="theList" data-role="listview" data-inset="true" data-filter="true" ng-repeat="item in items" >
<td>
{{item._empID}}
</td>
<td>
{{item._firstname}}
</td>
<td>
{{item._lastname}}
</td>
<td>
{{item._address}}
</td>
<td>
{{item._city}}
</td>
<td>
{{item._pincode}}
</td>
<td>
{{item._state}}
</td>
<td>
{{item._country}}
</td>
</tr>
console.log中的数据:
[
Object
$$hashKey: "004"
__type: "WebService+Employee"
_address: "add1"
_city: "city1"
_country: "count1"
_empID: "1"
_firstname: "fname1"
_lastname: "lname1"
_pincode: "pin1"
_state: "state1"
__proto__: Object
]
Object
__type: "WebService+Employee"
_address: "add1"
_city: "city1"
_country: "count1"
_empID: "1"
_firstname: "fname1"
_lastname: "lname1"
_pincode: "pin1"
_state: "state1"
__proto__: Object