can't use angular with input



  • Hello, i used angular with onsen-input and it works perfectly; however, when i change from <ons-input> to normal tag <input> it seems like the ng-model didn’t bind the value at all. any solution?

    <ons-page ng-controller="RegisterController" id="register.html">
        <ons-toolbar>
            <div class="center">Sign Up</div>
            <div class="left">
                <ons-back-button>Back</ons-back-button>
            </div>
        </ons-toolbar>
     <div class="login-form"> 
            <input id="username" type="text" class="text-input--underbar" modifier="underbar" placeholder="Username" float ng-model="page.username">
            <input id="email" type="email" class="text-input--underbar" modifier="underbar" placeholder="Email" float ng-model="page.email">
            <input id="password" type="password" class="text-input--underbar" modifier="underbar" type="password" placeholder="Password" float ng-model="page.password"></input>
           <br /><br />
            <ons-button modifier="large" ng-click="page.register()">Register</ons-button>
            
        </div>
    
    </ons-page>
    
    module.controller('RegisterController', function()
     {
         this.register = function()
         {
         var email = this.email;
         var password = this.password;
         var username = this.username;
         ons.notification.alert(email+password+username);
    
    
         };
     });
    


  • You need <form>

    <form name="formprueba" model="formData" >
        <input type="text" class="text-input" ng-model="formData['username']" name ='username' />
    </form>
    

Log in to reply