現在のコードでは、データを取得するためにダミーの方法を使用しています。そのような
var controlMeetings = $.ajax({
type: "GET",
url: "./Info.xml",
contentType: "text/xml",
dataType: "xml",
success: function (dataSource) {
controlMeetings = PureJson(dataSource);
}
});
function MeetingsCtrl( $scope, $compile ) {
$scope.meetings = controlMeetings;
$('#div1').html(
$compile(
'<ul><li ng-repeat="meeting in meetings"><a>{{meeting.count}}</a> <ul><li ng-repeat="child in meeting.children">{{child.meet}}</li></ul></li></ul>'
)($scope)
);
$('#div1').prepend('<div class="mHeader">Race cources</div>');
}
明らかに良くありません(はい、このコードを恥じています)が、動作するatmです。問題は、コントローラー内に $cope.meetings 変数を実際に入力し、グローバル変数の使用を回避する方法です。