问题
To simplified things, I've made a mistake in my question here: ng-repeat: One-item-only source
So I ask here the same question but with the real problem:
This is my code:
app.js
$http.get("http://angularjs.uum.my/tt.xml",
{transformResponse:function(data) {
// convert the data to JSON and provide
// it to the success function below
var x2js = new X2JS();
var json = x2js.xml_str2json( data );
return json;
}
})
.success(function(response) {$scope.scrollItems3 = response.NewDataSet.Table;});
$http.get("http://angularjs.uum.my/tt2.xml",
{transformResponse:function(data) {
// convert the data to JSON and provide
// it to the success function below
var x2js = new X2JS();
var json = x2js.xml_str2json( data );
return json;
}
})
.success(function(response) {$scope.scrollItems4 = response.NewDataSet.Table;});
tt.xml - have only 1 element
http://angularjs.uum.my/app/#/timetable3
tt2.xml - have two 2 elements
http://angularjs.uum.my/app/#/timetable4
The problem is with page no. 1, where only one element exist, the page rendered empty list repeating x number of times (where x equal to number of child elements)
Is this known bug? How to solve this problem if the number of elements is unknown beforehand to the developer?
Unlike the previous question, here there is no array...
Please help, thanks for your time.
来源:https://stackoverflow.com/questions/27090336/ng-repeat-one-item-only-source-xml