fixed controllers;

This commit is contained in:
Jon Lambson 2017-08-11 09:09:41 -06:00
parent 9788e73afb
commit b27ba889ba
6 changed files with 24 additions and 12 deletions

View File

@ -33,7 +33,9 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
templateUrl: '/templates/home.html'
},
'notifications': {
templateUrl: '/templates/partials/notifications.html'
templateUrl: '/templates/partials/notifications.html',
controller: 'HomeController',
controllerAs: 'vm'
}
},
})

View File

@ -6,11 +6,13 @@ app.controller('HomeController', ['$scope', 'Auth', 'localStorageService', '$loc
$location.path('/splash-page');
};
function userAuth() {
return JSON.parse(localStorageService.get('userAuth'));
}
vm.userName = function(profile){
profile = Auth.getProfile();
return profile.email;
};
console.log('worked:', vm.userName());
}]);

View File

@ -11,5 +11,4 @@ app.controller('SignInController', ['$scope', 'Auth', '$location', 'localStorage
}();
};
}]);

View File

@ -2,10 +2,10 @@ app.factory('Auth', ['localStorageService', '$location', function(localStorageSe
var user;
return{
setUser : function(currentUser){
setUser: function(currentUser){
user = currentUser;
console.log("%c" + redirectedURL, "color: red; font-size: 72px;");
// console.log("%c" + redirectedURL, "color: red; font-size: 72px;");
if (redirectedURL === '/splash-page') {
$location.path('/launchpad-home');
@ -13,9 +13,13 @@ app.factory('Auth', ['localStorageService', '$location', function(localStorageSe
$location.path('/launchpad-' + redirectedURL);
}
},
isLoggedIn : function(){
isLoggedIn: function(){
user = JSON.parse(localStorageService.get('userAuth'));
return (user) ? user : false;
},
getProfile: function(profile) {
profile = user;
return profile;
}
};
}]);

View File

@ -19,7 +19,7 @@
</form>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ vm.message }} <i class="fa fa-user" aria-hidden="true"></i> <span class="caret"></span></a>
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ vm.userName() }} <i class="fa fa-user" aria-hidden="true"></i> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="feed.html" target="_blank">Preview My Public Site</a></li>
<li><a>Account Settings</a></li>

View File

@ -1,5 +1,10 @@
<div class="alert alert-success" role="alert">
<i class="fa fa-check"></i>
<span class="sr-only">Congrats:</span>
Cool Story Bro...
<span class="">
<i class="fa fa-check"></i>
Welcome: {{ vm.userName() }}
</span>
<span class="pull-right">
<i class="fa fa-times"></i>
</span>
</div>