Change displayed url for a custom one using AngularJs -


i have piece of code in nav bar

<li><a href=#products?scrollto=products">products</a></li> 

this in controller

$scope.$on('$routechangesuccess', function (newroute, oldroute) { $location.hash($routeparams.scrollto); $anchorscroll(); }); 

and in config

$routeprovider.when('/products', { templateurl: '../pages/home/home.html', controller : 'maincontroller' }); 

it work expected, since scrolls place #products div located if not in home page. (returning home page , scrolling down automatically).

now, in url says /products?scrollto=products#products

is there way change more www.home.com or www.home.com/products?

thanks!

you can pass hash $anchorscroll , go there without adding url.

$scope.$on('$routechangesuccess', function (newroute, oldroute) {     $anchorscroll($routeparams.scrollto); }); 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -