I'm trying to redirect back to the previous page using $timeout and $window.history.back(). So when form is submitted a message will show saying (thank you... bla bla) all good from here, but when redirecting back the $timeout doesn't seems to kick in.
<div class="thankyou" data-ng-show="vm.hideEnquiryForm">
<h3><i class="fa fa-envelope fa-x2"></i> Thank you for enquiring, we will get back to you as soon as possible.</h3>
<a href="javascript:history.back()">Return</a>
</div>
vm.submitForm = function () {
enquireService.postEnquireForm(vm)
.then(function (response) {
//$location.path(vm.returnUrl);
//console.log($location.path() + ' '+ vm.returnUrl);
if (!vm.hideEnquiryForm) {
vm.hideEnquiryForm = true;
}
$timeout(function () {
$window.history.back;
}, 3000);
})
}