次の routeProvider を構成しました。
angular.module('myModule').config ['$routeProvider', (provider) ->
provider
.when '',
templateUrl: '/templates/dashboard.html'
.when '/some_path/:some_param',
templateUrl: '/templates/dashboard.html'
そして、静的に提供されるラッピング テンプレートの次のとおりです。
また、適切に定義された templates/dashboard.html もあります。
URL に移動すると、最初のページが読み込まれますが、URL に a#
が後置されないため、コントローラーで URL を で書き換えようとするとエラーが発生します$location.path('fooPath')
。
具体的$location.path('fooPath')
には、URL を次のように変更しcurrent_dashboard_path/#/
てリロードしますが、私が期待していたのは URL が次のように設定されることです。
current_dashboard_path/#/
、その後location('fooPath')
、それをに変更します current_dashboard_path/#/fooPath
追加のコンテキスト: これを使用して、$location
サービスを使用してページをリロードせずに URL を変更できるようにしたい
#
質問は、 ng-view が読み込まれたときに Angular に後置を強制するにはどうすればよいかということです。