Angularアプリをリファクタリングして、ファクトリサービスを介して重要なデータを渡しました。突然、ng-repeatはページに何も出力せず、まったく実行されず、エラーメッセージも表示されません。どうしたの?
<ul ng-repeat="section in sections">
<li class="section_title {{section.active}}" >
{{section.name}}
</li>
<ul>
<li class="tutorial_title {{tutorial.active}}" ng-click="loadFromMenu([$parent.$index, $index])" ng-repeat="tutorial in AppData.section.tutorials">
{{tutorial.name}}
</li>
</ul>
</ul>
var Tutorials = angular.module('Tutorials', ['functions', 'tutorials']);
Tutorials.factory("AppData", function(){
return {
sectionNumber: 0,
tutorialNumber: 0,
questionNumber: 0,
sections: sections
}
})
Tutorials.run(function(AppData){loadFromMenu([0,0, true], AppData);})
function loadFromMenu (tut, AppData) {
if (tut[1] === AppData.tutorialNumber && tut[0] === AppData.sectionNumber && !tut[2]) {//if clicked on already playing tut
return;
}
if (tut[1] !== undefined && tut[0] !== undefined) {
AppData.tutorialNumber = tut[1];
AppData.sectionNumber = tut[0];
}
var section = AppData.sections[tut[0]];
for (var x in AppData.sections) {
AppData.sections[x].active = "inactive";
for (var y in AppData.sections[x].tutorials){
AppData.sections[x].tutorials[y].active = "inactive";
}
}
section.active = "active";
section.tutorials[tut[1]].active = "active";
//$scope.$apply();
AppData.questionNumber = 0;
if (AppData.sectionNumber === 1){
conjugationController();
}
};