I have a peculiar problem. I use the anchorScroll service to scroll up the page to show any messages, for example, for error messages or saving successful messages. I implement a function in the action of a save button.
What happens when I first clicked the button, it refreshes the page, and then when I use it again, I get the desired result.
I would like to somehow stop him from refreshing the page for the first time.
This button is outside the form directive, although my form is inside the form tag. $ AnchorScroll enabled
<a id="top"></a> at the top of my HTML page.
if(data.validateError==true )
{
$scope.saveSuccessfull=false;
$scope.wrongInputError=true;
$scope.negErrorMessage=false;
$scope.loaderDiv=false;
$location.hash('top');
// call $anchorScroll()
$anchorScroll();
source
share