2017-12-27 3 views
0

안녕하세요, $ locatioProvider를 통해 htm5lMode와 함께 ngRoute의 angularjs를 사용하고 있지만 localhost : 3000/profile로 이동하여 부분로드없이 indext 페이지를 가져 오는 경우 localhost : 3000/#/profile URL이 http://localhost:3000/#!#%2Fprofile으로 변경되고 여전히 색인 페이지에 남아 있습니다. 따라서 그것은 localhost : 3000/#!/profile에 수동으로 이동할 때만 작동합니다 (부분로드). 나는 hashbang url을 피하고 싶다. 어떤 생각이 당신은 html5Mode에 부울 값을 전달 해야하는urlrewriting 및 html5mode가 각도 js에서 작동하지 않습니다

.config(['$locationProvider', '$routeProvider', function ($locationProvider, $routeProvider) { 
     $routeProvider.when('/profile', { 
     templateUrl: 'partials/pro.html', 
     controller: 'kontrola' 
     }) 

     $locationProvider.html5Mode('true') 
     $locationProvider.hashPrefix('!') 
    }])` 

답변

0

하시기 바랍니다. 하지만 당신은 문자열을 전달하고 있습니다.

$locationProvider.html5Mode('true')

이 있어야

$locationProvider.html5Mode(true)

관련 문제