Ionic Angular in a nutshell, while Angular has two common ways to view changes:
Markup:
<input type="search" placeholder="Search" ng-model="search" />
and code:
$scope.$watch('search',function (oldValue, newValue) { alert('changed') console.log(1) });
For completeness, there is also $watchGroup and $watchCollection
- Using the
ng-change togher directive with ng-model :
markup:
<input type="search" placeholder="Search" ng-model="search" ng-change="onSearchChange()" />
and code:
$scope.onSearchChange = function () { alert('changed') console.log(1) }
There are also advanced ways to get changes, such as creating a directive that talks to the ngModel directory controller and / or creating custom formatting and a parser to work with the ng model.
source share