0

I'm new to angularJS

i'm try to create a registration form using angularJS

but when i press submit it doesn't work.

The ng-disable attribute is working

HTML

<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8 well" ng-contoller="EditUserController">
      <form name="registerUser" class="form">
        <legend>Register</legend>
        <div class="form-group">
          <label for="inputFirstname">First Name :</label>
          <input type="text" name="firstname" id="inputFirstname" class="form-control" value="" required  title="" placeholder="First Name" ng-model="user.firstname">
        </div>
        <div class="form-group">
          <label for="inputLastName">Last Name :</label>
          <input type="text" name="lastname" id="inputLastName" class="form-control" value="" required title="" placeholder="Last Name" ng-model="user.lastname">
        </div>
        <div class="form-group">
          <label for="inputUsername">UserName :</label>
          <input type="text" name="username" id="inputUsername" class="form-control" value="" required  title="" placeholder="Username" ng-model="user.username">
        </div>
        <div class="form-group">
          <label for="inputEmail">Email :</label>
          <input type="email" name="email" id="inputEmail" class="form-control" value="" required title="" placeholder="your email" ng-model="user.email">
        </div>
        <button class="btn btn-primary" ng-disabled="registerUser.$invalid" ng-click="saveuser(user,registerUser)" >Submit</button>
      </form>       
</div>

EditUserController.js

motobike.controller('EditUserController',
function EditUserController($scope){
    $scope.saveuser = function(user, register){
        console.log(register);
        if (register.$valid) {
          window.alert('suceess');
        }   
    }
}   
);

app.js

'use strict';
var motobike = angular.module('motobike', ['ngSanitize']);
2
  • i have imported these js files in HTML <script type="text/javascript" src="js/lib/angular.min.js"></script> <script type="text/javascript" src="js/lib/angular-sanitize.min.js"></script> <script type="text/javascript" src="js/app.js"></script> <script type="text/javascript" src="js/controller/EditUserController.js"></script> ` Commented Dec 30, 2013 at 16:50
  • This question appears to be off-topic because it is about a typo Commented Dec 30, 2013 at 17:15

2 Answers 2

2

change ng-contoller to ng-controller ^^

Sign up to request clarification or add additional context in comments.

Comments

2
class="col-xs-8 col-sm-8 col-md-8 col-lg-8 well" ng-contoller="EditUserController"

should be

class="col-xs-8 col-sm-8 col-md-8 col-lg-8 well" ng-controller="EditUserController"

^^

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.