I getting value of text box using ng-model but in angular js it is undefined
for example;
<input type="text" ng-model="contactPersonName" placeholder="Contact Person Name">
<button ng-click="click(contactPersonName)">OK</button>
$scope.click=function(name){
alert("Contact Person Name : " + name);
}
O/P:::: Contact Person Name : undefined
Try to do like this enclose your variable inside an object
like this in your controller
$scope.person={};
in your view do like this
ng-model="person.contactPersonName";
also in ng-click function parameter
1 Like
I update your coding with this:
$scope.person={
âcontactPersonNameâ : ââ
};
ng-model=âperson.contactPersonNameâ;
and got successâŚbtw thank you so much 


1 Like