私は、Angular、jQuery Mobile、および tigbro による jQuery Mobile Angular アダプターを使用している Web ページに取り組んでいます。私はすべてを実行しており、1 つの問題を除いてうまく機能します。それは、ブラウザの更新ボタンを使用してページを更新すると、ルートを理解していないかのように 404 エラーが発生することです。2 つのフレームワークとアダプターが連携して動作することで少し混乱するため、問題がどこにあるのかわかりません。私はこれらすべてのテクノロジに不慣れです。
IE はたまたまこれが発生しない唯一のブラウザーであり、違いは URL にあるようです。IE でページを参照すると、次のように表示されます: http://site.com/SalesManagement/SalesManagementIndex.aspx#!/ViewNotes/4
Chrome などの別のブラウザーで同じページを参照すると、次のように表示されます: http://site.com/SalesManagement/ViewNotes/4
Chrome で最初の URL に移動すると、ページが読み込まれ、URL が 2 番目の URL に書き換えられます。
以下は私のルーティング構成です:
var SalesManagementApp = angular.module('SalesManagementApp', [])
SalesManagementApp.config(['$routeProvider', '$compileProvider', function ($routeProvider, $compileProvider) {
$routeProvider
.when('/Search', { templateUrl: 'Views/GrowerSearchView.aspx' })
.when('/SearchResults', { templateUrl: 'Views/GrowerResultsView.aspx' })
.when('/ViewNotes/:growerIndexKey', { templateUrl: 'Views/NotesHistoryView.aspx' })
.when('/EditNote/:growerIndexKey/:noteIndexKey', { templateUrl: 'Views/UpsertNoteView.aspx' })
.when('/AddNote/:growerIndexKey', { templateUrl: 'Views/UpsertNoteView.aspx' })
.when('/', { templateUrl: 'Views/GrowerSearchView.aspx' })
.otherwise({ templateUrl: 'Views/GrowerSearchView.aspx' });
} ]);
html5モードとハッシュバンモードについていくつか読んだことがありますが、構成でhtml5モードをオフまたはオンに設定すると、ルーティングがまったく機能しなくなりました。どんな助けでも大歓迎です。