jquery - on `Route` refresh getting issue with `angularjs` -
i have router
this:
"user strict"; angular.module("ngtenderdocument", ["ngroute", "ngresource", "docnavidir"]) .config(function ($routeprovider, $locationprovider) { $locationprovider.html5mode(true); $routeprovider.when('/', { controller : 'homecontroller', templateurl : 'views/home.html' }); $routeprovider.when('/chart', { controller : 'chartcontroller', templateurl : 'views/directiveviews/chart.html' }) });
as in home.html
page there link this:
<nav class="navbar navbar-inverse"> <ul class="nav navbar-nav"> <li class="active"><a id="first" href="#">first</a></li> <li><a id="prev" href="#">previous</a></li> <li><input type="text" ng-model="page.count" name="" id=""></li> <li><a id="next" href="#">next</a></li> <li><a id="last" href="#">last</a></li> **<li><a href="/chart">go chart page</a></li>** </ul> </nav>
when user click on link, page loading without issue. on click bower location bar reads :
http://localhost:3300/chart
but when refresh same location using browser getting error / message :
cannot /chart
how solve this? using server config this:
var connect = require('connect'), servestatic = require('serve-static'), app = connect(); app.use(servestatic('app')).listen(3300);
where need changes work refresh
ing router
url work without issue?
any 1 me?
by way:
http://localhost:3300/#/chart
//works fine , redirects http://localhost:3300/chart
you need configure serve-static. like:
var serve = servestatic('public/', {'index': ['home.html']}) app.use(serve).listen(3300);
are serving files out of public
folder?
Comments
Post a Comment