ModuleService.js 1.55 KB
var ATLAS_ANATOMY = 'Atlas Anatomy';
var CLINICAL_ILLUSTRATION = 'Clinical Illustrations';
var CLINICAL_ANIMATION = 'Clinical Animations';
var OpenedModuleItemList = [];
var ModDetail = [];


AIA.service('ModuleService', function($http, DataService) {       
    return {        
        loadModuleDataBasedOnModuleName: function(moduleName) {           
            var jsonPath;
            if (moduleName == ATLAS_ANATOMY) {
                jsonPath = '~/../content/data/json/aa/aa_dat_contentlist.json';
            }
            else if (moduleName == CLINICAL_ANIMATION) {
                //to do, in next phase of project
                jsonPath = '~/../content/data/json/ca/ca_dat_contentlist.json';
            }
            else if (moduleName == CLINICAL_ILLUSTRATION) {
                //to do, in next phase of project
                jsonPath = '~/../content/data/json/ci/ci_dat_contentlist.json';
            }

            return $http.get(jsonPath, function (response) {                                                       
                
               var moduleData = new jinqJs()
                                  .from(response.data.root.Item)
                                                              .orderBy([{ field: '_Title', sort: 'asc' }])
                                                              .select();
                console.log(JSON.stringify(response, null, 4));
                response.data= moduleData;
                return response.data;            
            });
        }
    };    
});