Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .when('/register', {
- templateUrl: 'views/register.html',
- controller: 'RegisterCtrl'
- })
- <div class="container">
- <div class="col-xs-2 col-sm-3 col-md-4"></div>
- <div class="col-xs-8 col-sm-6 col-md-4">
- <h1>Sign Up:</h1>
- <form>
- <div class="form-group">
- <label for="email">Email address:</label>
- <input type="email" class="form-control" id="email" ng-model="email">
- </div>
- <div class="form-group">
- <label for="username">Username:</label>
- <input type="text" class="form-control" id="username" ng-model="username">
- </div>
- <div class="form-group">
- <label for="pwd">Password:</label>
- <input type="password" class="form-control" id="pwd" ng-model="password">
- </div>
- <button type="submit" class="btn btn-primary col-xs-5" ng-click="register">Sign up</button>
- <div class="col-xs-2"></div>
- <button class="btn btn-info col-xs-5">Go to log in</button>
- </form>
- </div>
- </div>
- 'use strict';
- angular.module('angularApp')
- .controller('RegisterCtrl', function ($scope, $http) {
- $scope.email = '';
- $scope.username = '';
- $scope.password = '';
- $scope.register = function() {
- // TODO ADD VALIDATION
- var email = $scope.email;
- var username = $scope.username;
- var password = $scope.password;
- // $http request
- $http.post('http://localhost/PTC/API/new_user.php', email).
- success(function(data) {
- console.log(data);
- }).
- error(function(data) {
- console.log(data);
- });
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement