Whenever the button is clicked, I want to reset the input values to null. The function spremi() gets triggered when the button is clicked, but I want to set the values of podaci.tezina and podaci.mamac back to their initial values so that the user can enter new data.
.controller('SpremiCtrl', function($scope, $localStorage, $ionicPopup, $location, $window) {
$scope.ribe = ["Saran", "Stuka", "Som"];
var ribice = [];
$scope.spremi = function(t_tezina, m_mamac){
console.log(t_tezina);
console.log(m_mamac);
var podaci = {Tezina: t_tezina, Mamac: m_mamac};
console.log(podaci);
ribice.push(podaci);
$localStorage.fish = ribice;
console.log(ribice);
var confirmPopup = $ionicPopup.alert({
title: 'Saved'
});
};
html
<ion-view view-title="Browse">
<ion-content>
<select id="vrstaribe" ng-model="selekt" ng-options="r as r for r in ribe" selected>
<option value="">Fish Type</option>
</select>
<label class="item item-input">
<input id="tezina" type="number" placeholder="Weight" ng-model="podaci.tezina">
</label>
<label class="item item-input">
<input id="mamac" type="text" placeholder="Bait" ng-model="podaci.mamac">
</label>
<button class="button button-positive" ng-click="spremi(podaci.tezina, podaci.mamac)">Save</button>
<button class="button button-positive" ng-click="retrieve()">Show</button>
<button class="button button-positive" ng-click="reset()">Reset</button>
</ion-content>
</ion-view>