I have a list of "dimensions" which contains a list of chapters which contains a list of items:
"dimension" : [{
"dimensionName" : String,
"chapters":[{
"chapterName" : String,
"items":{"itemName":String}
}]
}]
what I want is to select the dimensions, chapter, and items in the same form of the original object("dimension" : [{"chapters":[{"items"}]}]).
this is my angular function to save the selected dimensions:
$scope.dimensionChanged = function(selected,dimension){
if(!$cookies.newObject) $cookies.newObject=[];
//the list to display chapters of selected dimension
if(!$scope.chaptersList) $scope.chaptersList = [];
for (var k in dimension.chapter) {
if(selected === true){
$cookies.newObject.push(dimension);
$scope.chaptersList.push(dimension.chapter[k]);
}else{
var index = $scope.chaptersList.indexOf(dimension.chapter[k]);
$scope.chaptersList.splice(index, 1);
}
}
};
what I need to do now is choose chapters and stock them in the associated dimension, and the same thing for items.
Aucun commentaire:
Enregistrer un commentaire