Thursday 15 August 2013

AngularJS doesn't refresh the page after rerouting -



AngularJS doesn't refresh the page after rerouting -

i have

mainapp.config(function ($locationprovider, $routeprovider) { $locationprovider.html5mode(true); $routeprovider .when('view1', { controller: 'simplecontroller', templateurl: 'views/page.html' }) .otherwise({ redirectto: '/views/page.html'}); });

which works, when go in browser main page

http://localhost:8080/web/main.html

it alter url

http://localhost:8080/web/views/page.html

but without refreshing page still see old content main.html instead

did miss step?

you redirecting to, shouldn't seeing .html,

you need start root if plan on doing spa type routing:

$routeprovider .when('/', { templateurl: 'main.html', controller: 'mainctrl' }) .when('/login', { templateurl: 'login.html', controller: 'loginctrl' }). .otherwise({ redirectto: '/' });

angularjs

No comments:

Post a Comment