WIP Domain listing app with automatic status checking. Buitl with AngularJS.

header.js 853B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. /**
  3. * @ngdoc function
  4. * @name domainManagerApp.controller:MainCtrl
  5. * @description
  6. * # MainCtrl
  7. * Controller of the domainManagerApp
  8. */
  9. angular.module('domainManagerApp.header', ['domainManagerApp.userData'])
  10. .controller('HeaderController', ['$scope', '$rootScope', '$location', 'UserData', function ($scope, $rootScope, $location, UserData) {
  11. $scope.isActive = function (viewLocation) {
  12. return viewLocation === $location.path();
  13. };
  14. $scope.isAuthenticated = UserData.isAuthenticated();
  15. console.log($scope.isAuthenticated)
  16. $rootScope.$on('user:isAuthenticated', function(data, isAuthenticated) {
  17. // you could inspect the data to see if what you care about changed, or just update your own scope
  18. $scope.isAuthenticated = isAuthenticated;
  19. console.log($scope.isAuthenticated)
  20. });
  21. }]);