Created
February 12, 2015 19:53
-
-
Save Dillie-O/bc7f3b014516ab5ad59d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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