K
K
khmlnk2015-06-16 21:14:45
Django
khmlnk, 2015-06-16 21:14:45

Is it possible using Django + Angular to make transitions between views without reloading the page?

Good day. Please tell me, is it possible using Django + Angular to make transitions between views without reloading the page?
Angular config code:

.config(['$routeProvider', function($routeProvider) {

            $routeProvider
            .when('/', {

              controller: 'MyCtrl',
              templateUrl: 'static/js/views/main.html'

            })
            .when('/profile/:id/', {

              controller: 'TestController',
              templateUrl: 'static/js/views/profile.html'

            })
            .otherwise({

              redirectTo: '/'

            })

Django url:
url(r'^#/profile/(?P<pk>[0-9]+)/$', SingleProfileView.as_view(), name='single'),

A link that, when clicked, should open another template without changing the browser's URL string:
<a ng-href='#/profile//'><p>Name: </p> </a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Tartmin, 2015-06-16
@baskerville42

Of course, it would be more correct to build the entire frontend on Angular, and give only data to Dzhang, without rendering. Another question is whether you need what you write then to SEO?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question