Coder Hub: AngularJS App.js

  • $rootScope.$on(‘$locationChangeStart’, function (event, next, current) { // redirect to login page if not logged in and trying to access a restricted page var restrictedPage = $.inArray($location.path(), [‘/login’, ‘/register’]) === -1; var loggedIn = $rootScope.globals.currentUser; if (restrictedPage && !
  • run.$inject = [‘$rootScope’, ‘$location’, ‘$cookieStore’, ‘$http’]; function run($rootScope, $location, $cookieStore, $http) { // keep user logged in after page refresh $rootScope.globals = $cookieStore.get(‘globals’) || {}; if ($rootScope.globals.currentUser) { $http.defaults.headers.common[‘Authorization’] = ‘Basic ‘ + $rootScope.globals.currentUser.authdata; // jshint ignore:line }
  • Subscribe to: Post Comments (Atom)

Read the full article, click here.


@VaghManishh: “AngularJS App.js #angularjs #app #dev #Coders #webdev #web #scripts #blogger”



Coder Hub: AngularJS App.js

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.