Skip to content

Instantly share code, notes, and snippets.

@Dillie-O
Created February 12, 2015 19:53
Show Gist options
  • Save Dillie-O/bc7f3b014516ab5ad59d to your computer and use it in GitHub Desktop.
Save Dillie-O/bc7f3b014516ab5ad59d to your computer and use it in GitHub Desktop.
angular.module('application')
.controller('NewsController', ['$scope', '$stateParams', '$state', '$http', '$location', 'AuthService', function ($scope, $stateParams, $state, $http, $location, authService) {
// Greg Added
$scope.authentication = authService.authentication;
if (authService.authentication.isAuth == true) {
alert("Auth")
}
else {
$location.path('/signup');
return;
};
// End Added (Below code unchanged)
$scope.newsTime = 'Not retrieved yet.';
$scope.getTime = function () {
var responsePromise = $http.get("/api/info");
responsePromise.success(function (data, status, headers, config) {
$scope.newsTime = data;
});
responsePromise.error(function (data, status, headers, config) {
$scope.newsTime = 'Failed to get time: ' + data;
});
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment