Skip to content

Instantly share code, notes, and snippets.

@gajus
Created October 1, 2014 13:14
Show Gist options
  • Save gajus/8db3b90db25db878ba08 to your computer and use it in GitHub Desktop.
Save gajus/8db3b90db25db878ba08 to your computer and use it in GitHub Desktop.
angular.module("sportsStoreAdmin")
.constant("authUrl", "http://localhost:5500/users/login")
.controller("authCtrl", function($scope, $http, $location, authUrl) {
$scope.authenticate = function (user, pass) {
$http.post(authUrl, {
username: user,
password: pass
}, {
withCredentials: true
}).success(function (data) {
$location.path("/main");
}).error(function (error) {
$scope.authenticationError = error;
}); }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment