javascript - angularjs url together with django framework -


i have small issue angular's ng-click() , redirecting new page. here problem:

in html have small d3 app attribute:

.attr("ng-click", "go(" + "'" + "{% url 'home' %}" + "'" + ")") 

in js document have:

$scope.go = function(link) {     $location.path(link); }; 

my base url sth like:

127.0.0.1:8000/username/test/ 

now when click on d3 element following:

127.0.0.1:8000/username/test/#home/ 

however wish have:

127.0.0.1:8000/home/ 

have got tips fix that? tried $location.hash(...) , no luck...

you can use $window service:

.attr("ng-click", "$window.location.href = '{% url 'home' %}'") 

$location when need stay inside same single page.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -