I am getting undefined in console .log.I am trying to get get data from my view .could you please tell me why it is not showing the model data .I will explain thing in other words
I have this in my login.html file
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text" ng-model="username">
</label>
I want to access username in my controller .controller name is authenticationCntrl
function authenticationCntrl($scope,$state) {
console.log('=====authenticationCntrl controller call')
console.log($scope.username)
console.log($scope.password)
$scope.forgetPassword=function(){
console.log($scope.username)
console.log("dddd")
console.log($scope.password)
}
I filled my username and password when I click "forget password" I get undefined value why ?
here is my code http://goo.gl/Nte89L
click preview to check output
You encountered the .
problem. From this article here:
Having a '.' in your models will ensure that prototypal inheritance is in play. So, use
input type="text" ng-model="someObj.prop1" rather than
input type="text" ng-model="prop1".
In your controller define a container object:
$scope.obj = {};
And in your HTML:
ng-model="obj.username"
ng-model="obj.password"