$window.scrollTo specific section of a page after a $location.path redirect in angular - angularjs

This link in the menu brings me to the dashboard. If I am on the dashboard and I click the link. The window scrolls to the section of the page I need it to go to. However, if I am on another page and I click this link it redirects but does not scroll to the specific section of the page. What can I do to get it to scroll when I am coming from another page other than the dashboard?
<li><a href ng-click="scrollToSection()" highlight=".content"><i class="fa fa-bell"></i>Click here</a></li>
$scope.scrollToSection = function(){
redirectServices.goToPage();
$window.scrollTo(0, 800);
}

Related

How to make your React page load on clicking a button with a <Link> element

<Link className="nav-link active" aria-current="page" to="/">Home</Link>
</li>
I wrote this ,when i click on the button
the url is updated but the page is not loading ,i have to refresh the page to load in to the page i desired
and also I am using react-router-dom#5.2.0 to use Switch .
I need to load the site to the path that i specified as i click the button

Ugly Url with in single page Angularjs

I have a <div id="section1"> </div> at the bottom of my page.
And I have a button I want this functionality in button
$location.hash('section1');
$anchorScroll();
It is working as I want but it is giving me ugly url all this is in single page than why my url is updating?
my expecting Url is :
/Order/BuildOrder
when page load I get this but when I click button screen took me to my anchor div with id='section1'
but now url change to /Order/BuildOrder#!#section1
How can I remove #!# as this is scrolling on a single page. href location is not changing

Angular ui-sref-active="active" not working on refresh

I have the following link
<a data-ui-sref-active="active" data-ui-sref="contact" href="javascript:void(0)">
Contact
</a>
It shows as active when I go to that page by clicking the link.
But the active class gets removed when I refresh the page.
How can I maintain the active page state when the user refreshes the browser?

AngularJS redirct to page and open modal

I have a page that has a navbar on it. when you click on a button in the navbar it should redirect you to a search page, and open a modal dialog. I'm not sure what I'm doing wrong, but it won't redirect to the page I've specified in the ng-click directive and the modal only opens when it has the search page open. Here's my button in the navbar
<button class="btn default-btn advancedbtn" data-toggle="modal" data-target="#myModal" ng-click="redirect()">Advanced</button>
Here's the code to redirect in my controller:
$scope.redirect = function () {
$location.url('/search');
}
I'm probably going about this in the wrong way. If any other code is needed let me know. Thanks.

How to make simple button navigation in ionic with angularjs

I'm making a functional button in my ionic app, and I want to know what I need to do to make a button centered on a blank ionic app load another page when clicked.
I have experimented with adding ng-click="loadPage()" to the button in my index.html file. I defined
$scope.loadPage = function() { $state.go(page.html)} in my controller.
switch your button with an anchor
<a class="btn btn-full" ui-sref="your.state">your text</a>

Resources