2016-03-24 6 views
0

簡単なルーティングで簡単な角度のアプリケーションを作成しました。マニュアルリフレッシュ後の角度リダイレクト/ブレークページ

angular.module("mainApp", ["ngRoute"]); 

angular.module("mainApp") 
.config(function ($routeProvider) { 
    $routeProvider 
    .when("/main", { 
     templateUrl: "views/main.html", 
     controller: "MainController" 
    }) 
    .otherwise({ redirectTo: "/main" }); 
}); 

"mongoose-free-6.1"サーバーを起動し、初めてページを開くとすべて正常に動作します。私のメインページのパスは次のとおりです。

http://192.168.0.16:8080/EventManagementMobile/EventManagementMobile/#/main 

ページの最初の手動更新した後、私はルートを取得する:

http://192.168.0.16:8080/main#/main 

ページが壊れていると、コンソールに私はエラーを取得する:

GET http://192.168.0.16:8080/views/main.html 404 (Not Found)(anonymous function) 
Error: [$compile:tpload] http://errors.angularjs.org/1.5.2/$compile/tpload?p0=views%2Fmain.html&p1=404&p2=Not%20Found 
at Error (native) 

同じIISExpressのVS2015から起動すると発生します。最初の経路は正常に動作します:

おそらくルーティングの仕組みがわかりません。ここでは何が起きるのですか ?

+0

これは非常に混乱の問題です。より多くのコードを表示することができれば、私は非常に満足しています。あるいは、Plunker/codepen/JSFiddle表現をもっと良くしてください! – amanuel2

+0

コードは単純ですが、空のページと空のコントローラーだけです。私は問題がサーバーにあると思う。サーバーを起動すると、パス:http://192.168.0.16:8080/から開始します。その後、私は自分のEventManagementMobileアプリケーションをブラウズしてブラウザをブラウズしてもOKです。すべての次の私は、サーバーのページを開始し、角度をちょうど "/ main"をパスに追加すると私は間違ったパスを取得します。私はプランカで再現しようとしますが、私は疑います。 – Milos

答えて

0

この問題は、角度とともにページ上にロードされたsynfusionライブラリによって引き起こされました。 synfusionサポートチームからの回答:元の質問と答えを

The script file ej.mobile.all.min.js is a collection of Essential Studio JavaScript Mobile components. In that, AppView acts as a base container and master page for the Mobile application. We have handled the history navigation internally for Single Page Applications, which interfere for Angular routing. Hence for Angular routing, we need to prevent the initialization of AppView. Refer to the following code example.

[html] 

<script> 
    App.preventAppviewInit = true 
</script> 

The above mentioned script have to be referred next to ej.mobile.all.min.js script reference.

がリンク:

http://www.syncfusion.com/forums/123560/loading-syncfusion-scripts-on-page-break-angular-routing

関連する問題