I have following pagination code
<pre>There are {{total_records}} number of records</pre>
<pagination ng-model="current_page"
total-items="total_records"
items-per-page="items_per_page"
max-size="max_size" class="pagination-sm"
boundary-links="true" rotate="false"
num-pages="numPages" ng-change="pageChanged()">
</pagination>
When I change pagination by clicking on the DOM it works. But when I try to change the pagination by setting $scope.current_page within code it doesn't trigger pageChanged.
For example,
On DOM let's say I am at 3rd page ($scope.current_page is 3) and on DOM 3rd page is active. If I go to page 4 by click on DOM then on DOM 4th page is got active, $scope.current changes to 4, and pageChagned is triggered.
But
On DOM let's say I am at 3rd page ($scope.current_page is 3) and on DOM 3rd page is active. If I go to page 4 by changing $scope.current_page to 4 in code then at DOM page change changes to 4 but pageChanged is not getting triggered.
How can I trigger pageChanged on changing $scope.current_page at code? I have seen another solution when they suggested to use $scope.$watch but I want to know better way of doing.
Edit:
I created following plnkr (I used this for first time, so not sure whether I have done correct or not). http://plnkr.co/edit/Kldv7ZbexpgifiPIsjCT?p=preview
The problem you can see is that when you click on "Go to 3rd page" button "page number" doesn't change on <pre></pre>
tags.
Thanks