각도 js의 단일 페이지에 대한 URL에서 해시 태그 (#)를 제거하고 싶습니다. 다음은 내 코드입니다 :Angular js의 단일 페이지에 대한 URL에서 해시 태그를 제거하는 방법
angular.config(['$routeSegmentProvider','$locationProvider'
function ($routeSegmentProvider,locationProvider) {
$routeSegmentProvider
.when('/test', 'sample')
.segment('sample', {
templateUrl: 'test/sample.html',
});
$locationProvider.html5Mode(true);
}
]);
이 코드로했을 때, 나는 같은 내 출력을 가지고, http://example.com/#%2Ftest%2F
내가 아래 같은 출력을 필요 http://example.com/test
사람이 찾아 도와 줄 수내 코드에 무엇이 잘못 되었습니까?
라우팅에 사용한 플러그인은 무엇입니까? –
@ganesh 각 도로 구간 – Sudha
@Sudha 대신 본 (** $ locationProvider.html5Mode (true); **) 행을 사용하고 ** ** 태그는 html5Mode에 필요합니다. –
Natiq