Looking at the code you posted on codepen (posted here, because the code you posted in your question doesn't provide enough context);
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope, $timeout) {
$scope.myTitle = 'Template';
$scope.data = { 'volume' : '5' };
$scope.count = 0;
$scope.plusOne = function() {
$scope.count++
}
if ($scope.count == $scope.data.volume) {
alert('finished')
}
});
You are only checking if $scope.count == $scope.data.volume once, when the controller is instantiated. Your code doesn't account for the fact that you need to do the check when the values actually change too. You'll need to use $scope.$watchCollection.
If using Angular > 1.2 (and it looks like you are from your codepen)...
$scope.$watchCollection('[count,data.volume]',function() {
if ($scope.count == $scope.data.volume) {
alert('finished')
}
});
Note, that first parameter to $scope.$watchCollection is not an array - it's a string that sort of looks like an array.