I want to use ng-focus for input text, It is not working but it gives old value, First time. I want to use the date field value in controller to create dynamic URL, It will fetch the JSON data corresponding date, So here I am creating dynamic URL corresponding that date, So I need date in controller.
One more thing, I following demo I am using directive, fromdatepicker and todatepicker, is there any other approach ?
Pluker DEMO http://plnkr.co/edit/1KRNBUXyK5O6LNwDS06x?p=preview
HTML
<input ng-model="from_date" ng-focus="changeFromDate()" type="text"/>
Angularjs
app.controller('myCtrl', function($scope) {
$scope.item = ""
$scope.changeFromDate = function() {
$scope.$apply();
alert($scope.item);
}
});