0
我在嘗試使用運動ID來過濾運動Feed。但json提要是基於@屬性的提要。如何使用ng-filter Json [@attributes]使用Angularjs?
JSON源
series: [
{
@attributes: {
id: "cdf590b4-0206-45b0-9122-20eae46a2b27",
name: "Pakistan tour of Sri Lanka, 2015",
year: "2015"
},
match: [
{},
{},
{},
{}
],
comment: []
},
{
@attributes: {
id: "324e971e-2044-4fa6-bdb2-0c47c99da64e",
name: "South Africa tour of Bangladesh, 2015",
year: "2015"
},
match: [
{},
{},
{},
{}
],
comment: []
},
我的控制器
--So this my controller code.--
$http.get('http://example.com/cricket.php').then(function(response) {
$scope.sports = sports;
$scope.whichsports = $state.params.id;
}
這我的瀏覽器代碼
<ion-item ng-repeat="sport in sports | filter: { id : whichsports }">
所以PLE幫助我。
高級謝謝。
感謝您的時間!當我使用sport ['@ attributes']時,我在'_item_ in _collection_'中出現了錯誤:[ngRepeat:iidexp]'_item_'應該是一個標識符或'(_key_,_value_)'表達式,但'sport [ '@屬性']」。' –