how to make Django play well with Angular URL -
in angular 2 app that's served django, how make angular 2 url work django when reloading page?
specifically, page served django has url http://localhost:8000/home
. page contains 3 tabs , under 1 of angular app. clicking on tab shows angular app, , url changes http://localhost:8000/home/ng_app
. if browser refreshed this url, django show 404, makes sense because http://localhost:8000/home/ng_app
not present in django app.
so how make angular url work? (entering http://localhost:8000/home/ng_app
leads angular app instead of 404). thanks!
assuming entire app served /home
, can use following url pattern:
urlpattern('/home/.*$', views.my_angular_homepage)
if want redirect route of after can use of standard tricks capture trailing part of url, , $location.path
in angularjs app.
Comments
Post a Comment