function LoginCtrl($scope, Login, $location)
{
$scope.login = function()
{
alert("login Clicked");
alert("Data sent : " + JSON.stringify($scope.user));
Login.save($scope.user, function(data)
{
alert("Save");
if(data.secure.authorised === "true")
{
$scope.currentUser.email = data.secure.email;
$scope.currentUser.password = $scope.user.password;
$scope.currentUser.show = true;
$scope.currentUser.name = data.secure.name;
$scope.currentUser.id = data.secure.id;
$scope.currentUser.region = data.secure.country;
$scope.loggingin = true;
$scope.errorMessage = false;
$location.path("/home");
}else{
alert("login failed.")
$scope.errorMessage = true;
}
});
};
}
--------------
angular.module("auth", ['ngResource'])
.factory("Login", function($resource)
{
return $resource('server/?type=login');
});
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.