node.js - why i got page not found when i refresh browser on angularjs? -
i using ng-route html5 mode , http-server in npm. have main page ng-view, , when click on link view displays fine. when refresh view display out header. below
.config(['$routeprovider', function ($routeprovider) { //console.log($routeprovider); $routeprovider. when('/app/gateways', { templateurl: '/app/gateways.html', }). when('/app/lights', { templateurl: '/app/lights.html', }). when('/app/control', { templateurl: '/app/assign-gateway-to-user.html', }) //otherwise({ // redirectto: '/app/index.html' //}); }]) .config(['$locationprovider', function($locationprovider) { $locationprovider.html5mode({ enabled: true, requirebase: false, }); }])
change code this. don't have define config again inject new providers. can in single step
.config(['$routeprovider', '$locationprovider', function($routeprovider, $locationprovider) { //console.log($routeprovider); $locationprovider.html5mode({ enabled: true, requirebase: false, }); $routeprovider. when('/app/gateways', { templateurl: '/app/gateways.html', }). when('/app/lights', { templateurl: '/app/lights.html', }). when('/app/control', { templateurl: '/app/assign-gateway-to-user.html', }) //otherwise({ // redirectto: '/app/index.html' //}); }])
Comments
Post a Comment