Skip to content

Instantly share code, notes, and snippets.

@henryboldi
Created June 24, 2014 03:39
Show Gist options
  • Save henryboldi/5ca2edd91ae9e49db95b to your computer and use it in GitHub Desktop.
Save henryboldi/5ca2edd91ae9e49db95b to your computer and use it in GitHub Desktop.
app.controller('Session', function ($scope, $http) {
$scope.title = "HackerBracket";
$scope.user = {};
$scope.init = function () {};
$scope.login = function () {
var url = '/api/login';
$http.post(url, $scope.user).success(function (data, status, headers, config) {
console.log(data);
console.log('success');
window.location = '/'+data.user.username;
}).error(function(data, status, headers, config){
console.log(data);
console.log('error');
});
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment