JavaScript Getting Django to play nice with Angular routing

I have an existing Django project and am adding a new app which consists of an API (using the rest-framework) and an angular app. This app contains one Django template, which simply serves as a way for Angular to hook in, and then work with it's own partials:

{% extends "base.html" %}
{% block content %}

<div ui-view></div>

{% endblock %}

From here, I would like for angular to take over the routing of the application:

$resourceProvider.defaults.stripTrailingSlashes = false;

// Routing
$locationProvider.html5Mode({
  enabled: true,
  requireBase: false
});

$stateProvider
    .state('list', {
        url: '/routines',
        templateUrl: 'static/partials/routine/routine_list.html',
        controller: 'RoutineListController',
    })
    .state('add', {
        url: '/routines/add',
        templateUrl: 'static/partials/routine/routine_add_edit.html',
        controller: 'RoutineAddController',
    });

$urlRouterProvider.otherwise('/routines');

This works fine for the first page the app loads, however attempting to navigate to any subsequent page results in Django displaying a 404 error message

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/routines/add

Based on my current (limited) knowledge of both systems, I attempted to specify a url in my Django config that would apply to all routine/* urls and not load a template, allowing angular to request the partial it requires so it can continue running the SPA uninterrupted. However, I was unable to find any information on specifying a URL without a template, leading me to believe that this is not the correct solution.

urlpatterns = [

url(r'^$', views.routineView, name='routine'),

url(r'^/.*$', views.routineView, name='angular'),

Summary: I would like to use Angular and a Django rest API app to create a web application. However, I would like to keep the rest of my existing Django site and simply add this on (an embedded SPA in my current Django base.html template). How do I set up the routing (on both Angular and Django) so that Django allows Angular to run interrupted once a certain page has been requested (in this case site.com/routines).

Answer:1

I'm just a beginner I want to create button for remove clone but I can't. This is my code but it isn't work. Please help me to know where did I wrong. PS. Sorry for my poor English HTML <div ...

I'm just a beginner I want to create button for remove clone but I can't. This is my code but it isn't work. Please help me to know where did I wrong. PS. Sorry for my poor English HTML <div ...

I have a 'Phone Number' field in my web form. I also have a 'hidden' form field which contains a unicode phone icon [&#9742]. Entering a phone number is optional for my site visitors. So... if ...

I have a 'Phone Number' field in my web form. I also have a 'hidden' form field which contains a unicode phone icon [&#9742]. Entering a phone number is optional for my site visitors. So... if ...

  1. passing value to hidden form field jquery
  2. how to get input type hidden value in jquery
  3. pass value to hidden field jquery

If I have something like this: class MyComponent { constructor() { this.interval = Observbale.interval(1000); } } const c = new MyComponent(); const subscription = c.interval.subscribe(() ...

If I have something like this: class MyComponent { constructor() { this.interval = Observbale.interval(1000); } } const c = new MyComponent(); const subscription = c.interval.subscribe(() ...

I have an array which is binded by reference as a model (to handsontable). Let's call it data. At some point I need to recalc it from scratch (let's call a calced new array freshData; it may have a ...

I have an array which is binded by reference as a model (to handsontable). Let's call it data. At some point I need to recalc it from scratch (let's call a calced new array freshData; it may have a ...

  1. what is a national emergency
  2. whatsapp
  3. whataburger
  4. what time is it
  5. what is my ip
  6. what song is this
  7. what is a state of emergency
  8. what is a dry cough
  9. what happens in a national emergency
  10. what is the stafford act
  11. what is a bear market
  12. what does ���� mean
  13. what to watch
  14. what stocks to buy today
  15. whataburger menu
  16. what is the weather
  17. what is rsv
  18. what is gluten
  19. what is pv
  20. what is a boomer