Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. .when('/register', {
  2. templateUrl: 'views/register.html',
  3. controller: 'RegisterCtrl'
  4. })
  5.  
  6. <div class="container">
  7. <div class="col-xs-2 col-sm-3 col-md-4"></div>
  8. <div class="col-xs-8 col-sm-6 col-md-4">
  9. <h1>Sign Up:</h1>
  10. <form>
  11. <div class="form-group">
  12. <label for="email">Email address:</label>
  13. <input type="email" class="form-control" id="email" ng-model="email">
  14. </div>
  15. <div class="form-group">
  16. <label for="username">Username:</label>
  17. <input type="text" class="form-control" id="username" ng-model="username">
  18. </div>
  19. <div class="form-group">
  20. <label for="pwd">Password:</label>
  21. <input type="password" class="form-control" id="pwd" ng-model="password">
  22. </div>
  23. <button type="submit" class="btn btn-primary col-xs-5" ng-click="register">Sign up</button>
  24. <div class="col-xs-2"></div>
  25. <button class="btn btn-info col-xs-5">Go to log in</button>
  26. </form>
  27. </div>
  28. </div>
  29.  
  30. 'use strict';
  31.  
  32. angular.module('angularApp')
  33. .controller('RegisterCtrl', function ($scope, $http) {
  34. $scope.email = '';
  35. $scope.username = '';
  36. $scope.password = '';
  37.  
  38. $scope.register = function() {
  39. // TODO ADD VALIDATION
  40. var email = $scope.email;
  41. var username = $scope.username;
  42. var password = $scope.password;
  43.  
  44. // $http request
  45. $http.post('http://localhost/PTC/API/new_user.php', email).
  46. success(function(data) {
  47. console.log(data);
  48. }).
  49. error(function(data) {
  50. console.log(data);
  51. });
  52. };
  53. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement