I have been referring to the ng-token-auth documentation here in an attempt to implement a resolver for authentication using the validateUser function. However, when I add the code snippet provided in the documentation to my app.js file under the "home" state resolve block, it results in rendering a blank screen. Surprisingly, there are no errors showing up on my Rails server console or in the Chrome javascript console. Any insights into why this issue might be occurring?
Below is a snippet of my app.js file where the problematic code lies within the resolve block for the "home" state.
sparkleApp = angular.module("sparkleApp",
['templates',
'validation.match',
'ui.bootstrap',
'ngSanitize',
'ui.router',
'LocalStorageModule',
'pippTimelineDirectives',
'ng-token-auth',
'sparkleControllers',
'sparkleServices']);
/* Controllers */
var sparkleControllers = angular.module('sparkleControllers', []);
/* Services */
var sparkleServices = angular.module('sparkleServices', []);
sparkleApp.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
// HOME STATES AND NESTED VIEWS ========================================
$stateProvider.state('home', {
url: '/',
views: {
// the main template will be placed here (relatively named)
'': {
templateUrl: 'tplHomeView.html',
controller: 'HomeCtrl'
},
'homeJumbotron@home': {
templateUrl: '_tplJumbotron.html'
},
'sparkleForm@home': {
templateUrl: '_tplMessageForm.html'
},
'sparkleFeatured@home': {
templateUrl: '_tplSparkleQuotes.html'
}
},
resolve: {
auth: function($auth) {
return $auth.validateUser();
}
}
})
}])
.config(function($authProvider) {
$authProvider.configure({
apiUrl: '/api/v1'
});
});