When I try to get the value of an input field in my controller it is always undefined. It seems like the angularJS two-binding is not working.
This is the angularJS code:
app.controller('MainCtrl', $scope)
{
var quan = $scope.quantity;
alert(quan);
}
the html
<form ng-controller="MainCtrl" class="form-inline" role="form" padding-left:10em">
<input type="text" class="form-control" id="quantity" ng-model="quantity" />
</form>
I cannot get the value of the input in my controller.