Commit ca529169 authored by Evren Kutar's avatar Evren Kutar

routeProvider to app.js to lazyload modules

parent 0bae77f3
'use strict';
// Declare app level module which depends on views, and components
angular.module('zaerp', [
'ngRoute',
'ngSanitize',
'ngAnimate',
'ngQuantum',
'zaerp.dashboard',
'zaerp.login',
'zaerp.version',
'schemaForm'
]).
angular.module(
'zaerp', [
'ngRoute',
'ngSanitize',
'ngAnimate',
'ngQuantum',
'zaerp.dashboard',
'zaerp.login',
'zaerp.version',
'schemaForm'
]).
config(['$routeProvider', function ($routeProvider) {
console.log("redirect to login");
$routeProvider.otherwise({redirectTo: '/'});
$routeProvider
.when('/login', {
templateUrl: 'login/login.html',
controller: 'LoginCtrl'
})
.when('/dashboard', {
templateUrl: 'dashboard/dashboard.html',
controller: 'DashCtrl'
})
.otherwise({redirectTo: '/dashboard'});
}]).
run(function ($rootScope, $location) {
$rootScope.$on("$routeChangeStart", function (event, next, current) {
......
......@@ -9,10 +9,10 @@
angular.module('zaerp.dashboard', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/dashboard', {
templateUrl: 'dashboard/dashboard.html',
controller: 'DashCtrl'
});
//$routeProvider.when('/dashboard', {
// templateUrl: 'dashboard/dashboard.html',
// controller: 'DashCtrl'
//});
}])
.controller('DashCtrl', function ($scope) {
$scope.testData = "<h1>This is main Dashboard</h1>";
......
......@@ -6,10 +6,10 @@
var login = angular.module('zaerp.login', ['ngRoute', 'schemaForm']);
login.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/login', {
templateUrl: 'login/login.html',
controller: 'LoginCtrl'
});
//$routeProvider.when('/login', {
// templateUrl: 'login/login.html',
// controller: 'LoginCtrl'
//});
}]);
login.controller('LoginCtrl', function ($scope, $http, $location, $rootScope, AUTH_EVENTS, LoginService) {
$scope.schema =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment