J
J
Jarwis2014-11-28 07:06:30
Angular
Jarwis, 2014-11-28 07:06:30

AngularJS NgRoute - why does it refresh the page?

I'm trying to figure out angular.js and I'm having a problem with ng-route. I configure $routeProvider:

$routeProvider.when(
                '/', {
                    controller: 'pageController',
                    templateUrl: '/Templates/PageTemplate'
                })
            .when(
                '/About', {
                    controller: 'pageController',
                    templateUrl: '/Templates/PageTemplate'
            });

But for some reason when I click on the link:
<li><a href="/">Главная</a></li>
 <li><a href="/About">О проекте</a></li>

the page is being updated.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Romanov, 2014-11-28
@Serhioromano

Need
Forgot hash and url become url. If you want without a hash, then you need to add it to config
$locationProvider.html5Mode(true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question