Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- form(class='form-auth' ng-submit='register()')
- p(class='text-warning'){{error_message}}
- label(for='email') Email
- input(type="email", ng-model='users.email', name="email", placeholder='Email')
- label(for='password') Password
- input(type="password", ng-model='users.password', name="password", placeholder='Password')
- input(type="submit" class='submitBtn' value='Go')
- app.controller('authController', function($scope, $rootScope, $http, $location){
- $scope.user = {email: '', password: ''};
- $scope.error_message = '';
- $scope.register = function(){
- $http.post('/auth/signup', $scope.user).success(function(data){
- if(data.state == 'success'){
- $rootScope.authenticated = true;
- $rootScope.current_user = data.user.username;
- $location.path('/');
- }
- else{
- $scope.error_message = data.message;
- }
- });
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement