controller - fectching textbox value from angularjs -


I am using angularjs, where I have created a login form and a controller where I get the value of the text box I am trying to do My HTML looks like this:

  & lt; Div class = "form-group" & gt; & Lt; Label = "username" & gt; Username: & lt; / Label & gt; & Lt; Input type = "text" class = "form-control" id = "user.uname" placeholder = "enter username" ng-model = "usname" & gt; & Lt; / Div & gt; & Lt; Div class = "form-group" & gt; & Lt; Label = "username" & gt; First name: & lt; / Label & gt; & Lt; Input type = "text" class = "form-control" id = "user.firstname" placeholder = "enter first name" & gt; & Lt; / Div & gt;  

And I've got a controller like:

  module1.controller ('RegisterController', function ($ radius, $ http) {$ scope.XHR_Result = "XHR is not started yet"; // $ scope.User = {}; $ scope.User = {username: "", first name: "", last name: "", email id: "", password: ""}; ...................  

In the controller, I want to get the value of the textbox mentioned above in the HTML page Can you please tell me, I value the text box in the controller .

You just need to use the cooner two-way binding

For your code, what you need to do is change the ng-model to < user.firstname

< Input & gt; element and type =" text "class =" form-control "ng-> code User.firstname "placeholder R =" Enter first name "& gt;

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -