I want to set value when query textbox is empty. I want to do like this:
$scope.flag=0;
This is query textbox:
<input type="text" ng-model="query" ng-change="search()" />
When user types something, I set $scope.flag=1 in js file. Hope you catch my problem. Please do needfull.
HTML
<div ng-controller="myCtrl">
<input type="text" ng-model="query" ng-change="search()" />
{{ flag }}
</div>
JS
app.controller('myCtrl', function($scope){
$scope.flag=0;
$scope.search = function() {
$scope.flag= $scope.query.length >0 ? 1:0;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With