i am new in angularjs and javascript. my ngroute and ozlazyload runs successfully but only once.
SPLK.config(function ( $ocLazyLoadProvider, $routeProvider) {
$ocLazyLoadProvider.config({
loadedModules: ['SPLK'],
modules: [
{
name: 'datatables-counsellorJS',
files: ['src/assets/demo/default/custom/crud/datatables/data-sources/ajax-server-side_.js', 'src/assets/vendors/custom/datatables/datatables.bundle.js'],
}
]
});
$routeProvider
.when('/counsellor/', {
templateUrl: 'view/counsellor.php',
controller: 'counsellorCtrl',
resolve: {
loadModule: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load('datatables-counsellorJS');
}]
}
})
.when('/registration/', {
templateUrl: 'view/registration.php',
controller: 'regCtrl',
})
.when('/reports/', {
templateUrl: 'view/reports.php',
controller: 'reportsCtrl',
})
.when('/statistics/', {
templateUrl: 'view/statistics.php',
controller: 'statsCtrl',
})
.when('/preferences/', {
templateUrl: 'view/preferences.php',
controller: 'prefCtrl',
})
.when('/counsellordetails/', {
templateUrl: 'view/counsellordetails.php',
controller: 'counsellorDetailsCtrl',
})
.otherwise({
templateUrl: 'view/dashboard.php',
controller: 'dashboardCtrl',
});
dashboard will be the landing page. if i click to /counsellor, the js can be loaded. but if i route to other links, and then click to /counsellor again, it does not work.
even i need to include both js in parent html.