My component has a data property daily_goal
.
I have a modal that is used to set a new value to daily_goal
.
I open my modal like so:
toSetDailyGoalPopup() {
this.$showModal(setDailyGoalPopup, {
fullscreen: true,
props: {daily_goal: this.daily_goal},
}).then(function(newGoal) {
alert(newGoal);
alert(this.daily_goal);
this.daily_goal = newGoal;
});
},
And I close my modal like this:
<button
text="Set"
@tap="modal.close(daily_goal)"
/>
When I press set in my modal. The modal is closed, then I get only one alert correctly telling me the new value that is supposed to be set, but the second alert is not displayed and the value is also not updated.
How can I change this code to achieve what I want?
Update The following did the trick:
.then(
((newGoal) => {this.daily_goal = newGoal;}).bind(this)
)