AngularJs UI Route script


'use strict';
/*-----------------------------
|
|This is a webmasters custom angularjs
|
-------------------------------
*/
var webapp = angular.module('webmastersApp', ['oc.lazyLoad','ui.router']);

webapp.config(['$stateProvider','$urlRouterProvider','$ocLazyLoadProvider',function ($stateProvider,$urlRouterProvider,$ocLazyLoadProvider) {

$ocLazyLoadProvider.config({
debug:true,
events:true,
});

$urlRouterProvider.otherwise('/dashboard');

$stateProvider
/*--Dashboard--*/
.state('dashboard', {
url: '/dashboard',
templateUrl: '/templates/webmasters/dashboard.html',
controller: 'dashboardController',
resolve: {
loadMyFiles:function($ocLazyLoad) {
return $ocLazyLoad.load({
name:'webmastersApp',
files:[
'/templates/webmasters/controllers/dashboardcontroller.js'
]
})
}
}
})
/*--general-settin--*/
.state('general-settings', {
url: '/general-settings',
templateUrl: '/templates/webmasters/general-settings.html',
controller: 'generalSettings',
resolve: {
loadMyFiles:function($ocLazyLoad) {
return $ocLazyLoad.load({
name:'webmastersApp',
files:[
'/templates/webmasters/controllers/generalsettings.js'
]
})
}
}
})
/*--my-profile--*/
.state('my-profile', {
url: '/my-profile',
templateUrl: '/templates/webmasters/my-profile.html',
controller: 'myProfile',
resolve: {
loadMyFiles:function($ocLazyLoad) {
return $ocLazyLoad.load({
name:'webmastersApp',
files:[
'/templates/webmasters/controllers/myprofile.js'
]
})
}
}
})
/*--change-password--*/
.state('change-password', {
url: '/change-password',
templateUrl: '/templates/webmasters/change-password.html',
controller: 'changePassword',
resolve: {
loadMyFiles:function($ocLazyLoad) {
return $ocLazyLoad.load({
name:'webmastersApp',
files:[
'/templates/webmasters/controllers/change-password.js'
]
})
}
}
})
// catch all route
// send users to the home page
}]);

Comments

Popular posts from this blog

How to do jQuery ajax post

SSH Commands