Skip to content

Instantly share code, notes, and snippets.

@srph
Last active August 29, 2015 14:05
Show Gist options
  • Save srph/171b9ee7a0af1a412a5e to your computer and use it in GitHub Desktop.
Save srph/171b9ee7a0af1a412a5e to your computer and use it in GitHub Desktop.
Leading / on urls
app.config([
'$stateProvider',
function($stateProvider) {
var state = {
name: 'login',
url: '/login',
// resolve: {
// guest: ['AuthSrvc', function(AuthSrvc) {
// return AuthSrvc.guest();
// }]
// }
templateUrl: '/app/components/login/template.html',
data: {
pageTitle: 'Login'
},
controller: 'LoginCtrl'
};
$stateProvider.state(state);
}
]);
app.config([
'$stateProvider',
function($stateProvider) {
var state = {
name: 'logout',
url: '/logout',
data: {
pageTitle: 'Logout'
},
resolve: {
logout: ['AuthSrvc', function(AuthSrvc) {
AuthSrvc
.logout
.then(function() {
$window.location.href = '/login';
});
}]
}
};
$stateProvider.state(state);
}
]);
app.config([
'$stateProvider',
function($stateProvider) {
var state = {
name: 'main.holiday',
url: 'holiday',
data: {
pageTitle: 'Manage Holidays'
},
resolve: {
holidays: ['HolidaySrvc', function(HolidaySrvc) {
var year = new Date().getFullYear();
return HolidaySrvc.get(year);
}]
},
templateUrl: '/app/components/main/holiday/template.html',
controller: 'HolidayCtrl'
};
$stateProvider.state(state);
}
]);
app.config([
'$stateProvider',
function($stateProvider) {
var state = {
name: 'main.home',
url: '',
templateUrl: '/app/components/main/home/template.html',
data: {
pageTitle: 'Dashboard'
},
// resolve: {
// }
};
$stateProvider.state(state);
}
]);
app.config([
'$stateProvider',
function($stateProvider) {
var state = {
name: 'main',
abstract: true,
url: '/',
templateUrl: '/app/components/main/template.html'
};
$stateProvider.state(state);
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment