Function continues looping in controller when using $state.go
<p>Im relatively new on Angular so i dont know if this is the best solution. 
But I have this state/route with a button, when clicked this function is called:</p>

<pre><code>_this.foo = function () {
    save();
    $state.go("next");
}
</code></pre>

<p>The problem is that when i get to the next state with the same controller, the function is still ongoing so it saves the next page to.Thats not what I want, i want it to save the first one, and then go to the next one and stop.</p>

<p><strong>Edit:</strong>
I have several forms in a list, every form has a approval button and disapproval button. When function save() is called all forms in the list is approved and saved to back-end. And then it redirects to the next page, but my app continues to save the next list of forms to. </p>

<p>Could i pass some parameter to the $state.go for it to stop the function? I have no idea why this is happening.</p>