I have a problem with a custom template that I made using Angular Formly. The template has one input text and two buttons for decrease and increase the model value of this input. The problem is that the down button works and decrease the model correctly, but the up button doesn't increase and instead performs the same action of $scope.down(). What am I wrong?
HTML Template:
<span class="spinner">
<button class="button decrease" ng-click="down()"></button>
<input type="text" ng-model="model[options.key]" name="{{options.key}}" />
<button class="button increase" ng-click="up()"></button>
</span>
Formly Field:
item.key = key;
item.type = "my_spinner";
item.defaultValue = item.templateOptions.placeholder;
item.controller = function($scope) {
$scope.down = function () {
$scope.model[$scope.options.key] = $scope.model[$scope.options.key] - 1;
};
$scope.up = function () {
$scope.model[$scope.options.key] = $scope.model[$scope.options.key] + 1;
}
};
}
Update: the code in JSBin seems to work http://jsbin.com/fakunoqeti/edit?html,js,console,output so what could it be the issue? I need an angular-formly expert D:D: