(function() {

	'use strict';

	// Setting up route
	angular.module('uniflash').config(configStates);

	configStates.$inject = ['$stateProvider', '$urlRouterProvider'];

	function configStates($stateProvider, $urlRouterProvider) {

		// Redirect to home view when route not found
		$urlRouterProvider.otherwise('/');

		// top level pages
		$stateProvider.
		state('welcome', {
			url: '/',
			templateUrl: 'welcome.html'
		});

	}
	
	angular.module('uniflash').run(['$rootScope', function($rootScope) {
		
		$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
			console.log(error);
			throw error;
		});

	}]);


})();