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
and type =" text "class =" form-control "ng-> code User.firstname "placeholder R =" Enter first name "& gt;
Comments
Post a Comment