I'd like to increase a number in a badge.
I set the number 0 in 'app.js'.
And I made minus button, plus button and textbox.
There is a number in the textbox.
If I tab the minus or plus button, the number would change.
I added an action in the button click function.
But the number in badge is not changed.
This is my code to change the number.
example.controller('EventController', ['$scope', function($scope) {
$scope.count = 0;
$scope.countBadge = 0;
$scope.$on('orderMinus', function() {
if($scope.count!=0){
$scope.count--;
}
if($scope.countBadge != 0){
$scope.countBadge--;
}
});
$scope.$on('orderPlus', function() {
if($scope.count<=29){
$scope.count++;
$scope.countBadge++;
}
});
}]);
<script id="page_dish.html" type="text/ng-template">
<div>
<ion-header-bar style="height:10%; background: none; border-bottom: none">
<a id = "button_menuList" href="#/page_menuList"></a>
<a id = "img_chopchop"></a>
<div ng-controller="EventController">
<span class="badge badge-assertive">{{countBadge}}</span>
</div>
<a id = "button_basket" href="#/page_join"></a>
</ion-header-bar>
</div>
<ion-view class = "page_dish" ng-controller="AppCtrl">
<ion-content class = "no-header no-footer" has-bouncing="false">
<ion-slide-box>
<ion-slide class = "episode1">
<div align = "left">
<img src="img/Episode/Main/Episode1/Text_title.png" style="width:80%; margin-left:5%; margin-top:25%;">
<img src="img/Episode/Main/Episode1/Label_price.png" style="width:40%; margin-left:5%; margin-top:4%;">
</div>
<div>
<a id = "button_learnMore1" ng-click="modal.show()"></a>
</div>
<div align = "left" ng-controller="EventController">
<a class = "button_minus1" ng-click="$emit('orderMinus')"></a>
<input type="text" style="position:absolute; width:95px; height:65px; margin-left:37.4%; font-size:55px; color:#ffffff; background-color:transparent; text-align:center;" value = {{count}} readonly = "true">
<a class = "button_plus1" ng-click="$emit('orderPlus')"></a>
</div>
</ion-slide>
</ion-slide-box>
</ion-content>
</ion-view>
</script>
How to fix my code to change the number in badge with click the button.
Please, help me.