I have a web application. Untiln now I've used .when to define all the url. Now I want to know better the $state. So, I have an web that is composed as follow: - login page (public) -- then (private): - dashboard home - users list
The private side is composed by: - navbar (top) whith welcome messagges - sidebar (right) with a list of buttons (Home and List) - view (where I see the dashboard home and then, if the user press 'List', see the users list).
In the main.js I've writter this:
'use strict';
angular.module('app', [
'app.login',
'app.dashboard'
]).config(
['$stateProvider', '$urlRouterProvider', '$resourceProvider',
function($stateProvider, $urlRouterProvider, $resourceProvider) {
$resourceProvider.defaults.stripTrailingSlashes = false;
$urlRouterProvider
.otherwise('/login');
$stateProvider
// Definizione dei template di base per le pagine
.state('app.dashboard', {
url: '/dashboard',
templateUrl: 'dashboard.html',
controller: 'dashboardCtrl'
})
.state('app', {
url: '/app',
abstract: true,
templateUrl: 'app.html',
})
.state('login', {
url: '/login',
templateUrl: 'login.html',
controller: 'LoginController'
})
.state('app.list', {
url: '/list',
templateUrl: 'list.html',
controller: 'ListController',
})
}])
What should be / or not should be an abstract? Should I do a 'common' $state? Also because I want to add an authorization which you can't go forward if you didn't signin. Can you help me to structure the routing and understand the abstract state?