ng-repeat: One-item-only source (XML)

谁说胖子不能爱 提交于 2019-12-12 04:50:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!