ocombe/ocLazyLoad

page refresh showing blank, template or controller not invoked

lalitsonje opened this issue · 0 comments

angular.module('PermissionSet', ['ui.router','oc.lazyLoad'])

.config(["$stateProvider","$urlRouterProvider","$ocLazyLoadProvider", function(t,e,$ocLazyLoadProvider){

 $ocLazyLoadProvider.config({
	    'debug': true, // For debugging 'true/false'
	    'events': true, // For Event 'true/false'
	    'modules': [{ // Set modules initially
	        name : 'loadPset', // State1 module
	        serie: true,
	    	files: [
	    	        "../permission-set-ui/lib/css/entitlement-studio.css",
	    			"../permission-set-ui/lib/css/create-entitlement.css",
	    			"../permission-set-ui/lib/css/modify-entitlement.css",
	    		    "../permission-set-ui/lib/css/bootstrap-multiselect.css",
	    			"../permission-set-ui/js/entitlement-studio/commons/formatter.js",
	    			"../permission-set-ui/js/entitlement-studio/factories/cmdbFactory.js",
	    			"../permission-set-ui/js/entitlement-studio/factories/entitlementFactory.js",
	    			"../permission-set-ui/js/entitlement-studio/factories/hostFactory.js",
	    			"../permission-set-ui/js/entitlement-studio/factories/userFactory.js",
	    			"../permission-set-ui/js/entitlement-studio/factories/applicationFactory.js",
	    			"../permission-set-ui/js/entitlement-studio/factories/analyseChangeFactory.js",
	    			"../permission-set-ui/js/entitlement-studio/directives/hostMetaDataDirective.js",
	    			"../permission-set-ui/js/entitlement-studio/directives/commandGroupFormDirective.js",
	    			"../permission-set-ui/js/entitlement-studio/directives/jqueryAutoCompleteDirective.js",
	    			"../permission-set-ui/js/entitlement-studio/directives/viewEntitlementDirective.js",
	    			"../permission-set-ui/js/entitlement-studio/directives/loadingSpinner.js",
	    			"../permission-set-ui/js/entitlement-studio/directives/analysisChangeDirective.js",
	    			"../permission-set-ui/js/entitlement-studio/entitlementStudioController.js",
	    			"../permission-set-ui/js/entitlement-studio/createEntitlementController.js",
	    			"../permission-set-ui/js/entitlement-studio/modifyEntitlementController.js",
	    			"../permission-set-ui/js/entitlement-studio/viewEntitlementController.js",
	    			"../permission-set-ui/pset.config.js"
	    	]
	    }],
		
	});
 
   t.state({
		name: "estudio",
		url: "/estudio",
		templateUrl: "../permission-set-ui/templates/entitlement-studio-templates/entitlement-studio.html",
		controller: "entitlementStudioController",
        ncyBreadcrumb: {
            label: 'Entitlement Studio'
        },
        resolve: {
        	entitlementStudioController: ['$ocLazyLoad', function($ocLazyLoad) {
                return $ocLazyLoad.load('loadPset'); // Resolve promise and load before view 
            }]
        }
	}).state({
		name: "createentitlement",
		url: "/createentitlement",
        ncyBreadcrumb: {
            label: 'Create Entitlement',
            parent: 'estudio'
        },
		templateUrl: "../permission-set-ui/templates/entitlement-studio-templates/create-entitlement.html",
		controller: "createEntitlementController",
		resolve: {
			applications: function(cmdbFactory) {
				cmdbFactory.getInitialData();
			},
			createEntitlementController: ['$ocLazyLoad', function($ocLazyLoad) {
                return $ocLazyLoad.load('loadPset'); // Resolve promise and load before view 
            }]
		}
	}).state({
		name: "modifyentitlement",
		url: "/modifyentitlement/:entitlementId",
        ncyBreadcrumb: {
            label: 'Modify Entitlement',
            parent: 'estudio'
        },
		templateUrl: "../permission-set-ui/templates/entitlement-studio-templates/modify-entitlement.html",
		controller: "modifyEntitlementController",
		resolve: {
			modifyEntitlementController: ['$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load('loadPset'); // Resolve promise and load before view 
			}],
			currentEntitlement: function($stateParams, entitlementFactory, cmdbFactory) {
				cmdbFactory.getInitialData();
				return entitlementFactory.getEntitlementById($stateParams.entitlementId);
			},
		}
	}).state({
		name: "viewentitlement",
		url: "/viewentitlement/:entitlementId",
        ncyBreadcrumb: {
            label: 'View Entitlement',
            parent: 'estudio'
        },
		templateUrl: "../permission-set-ui/templates/entitlement-studio-templates/view-entitlement.html",
		controller: "viewEntitlementController",

		resolve: {
			
        	viewEntitlementController: ['$ocLazyLoad', function($ocLazyLoad,$state) {
        		console.log("load pset fies");
                return $ocLazyLoad.load('loadPset'); // Resolve promise and load before view 
			}],
			currentEntitlement: function($stateParams, entitlementFactory) {
				console.log("inside function");
				return entitlementFactory.getEntitlementById($stateParams.entitlementId);
			},

/* resolveView: function($q,$stateParams, entitlementFactory) {

				 var loadentitlement=entitlementFactory.getEntitlementById($stateParams.entitlementId);
				 var loadFiles= $ocLazyLoad.load('loadPset'); // Resolve promise and load before view 
				 
				 return $q.all({ currentEntitlement: loadentitlement, viewEntitlementController: loadFiles }); 

					
			 },*/

		}
	})

}])