There is a button labeled Modify. When clicked, the modify() function is triggered and the text on the button changes to Save. Clicking on it again will execute the save() function.
Below are the codes:
<button class="btn btn-primary" ng-click="modify(); save()" ng-disabled="!modifyDisabled">{{button}}</button>
$scope.button="Modifier"
$scope.modify=function(){
$scope.button="Enregistrer"
$http.get("http://localhost:5000/settings").then(function(response){
$scope.settingsInserted = false
$scope.nbOperateurPresents= response.data.data[0].nbOperateurPresents
$scope.targetAmount1stHour= response.data.data[0].targetAmount1stHour
$scope.targetAmount2ndHour= response.data.data[0].targetAmount2ndHour
$scope.targetAmount3rdHour= response.data.data[0].targetAmount3rdHour
$scope.targetAmount4thHour= response.data.data[0].targetAmount4thHour
$scope.targetAmount5thHour= response.data.data[0].targetAmount5thHour
$scope.targetAmount6thHour= response.data.data[0].targetAmount6thHour
$scope.targetAmount7thHour= response.data.data[0].targetAmount7thHour
$scope.targetAmount8thHour= response.data.data[0].targetAmount8thHour
})
}
$scope.save=function(){
console.log('saved')
$scope.button="Modifier"
}
In order to trigger the modify() function on first click and save() on second click, a third function might be needed. Can someone assist with this?