Advertisement
Guest User

Untitled

a guest
Apr 12th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. form(class='form-auth' ng-submit='register()')
  2. p(class='text-warning'){{error_message}}
  3. label(for='email') Email
  4. input(type="email", ng-model='users.email', name="email", placeholder='Email')
  5. label(for='password') Password
  6. input(type="password", ng-model='users.password', name="password", placeholder='Password')
  7. input(type="submit" class='submitBtn' value='Go')
  8.  
  9. app.controller('authController', function($scope, $rootScope, $http, $location){
  10. $scope.user = {email: '', password: ''};
  11. $scope.error_message = '';
  12. $scope.register = function(){
  13. $http.post('/auth/signup', $scope.user).success(function(data){
  14. if(data.state == 'success'){
  15. $rootScope.authenticated = true;
  16. $rootScope.current_user = data.user.username;
  17. $location.path('/');
  18. }
  19. else{
  20. $scope.error_message = data.message;
  21. }
  22. });
  23. };
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement