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

header.js 817B

123456789101112131415161718192021222324
  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. $rootScope.$on('user:isAuthenticated', function(data, isAuthenticated) {
  16. // you could inspect the data to see if what you care about changed, or just update your own scope
  17. $scope.isAuthenticated = isAuthenticated;
  18. console.log($scope.isAuthenticated)
  19. });
  20. }]);