2014-01-05 15 views
1

我正在將我們的應用程序移動到Angular的過程中,這是我的路線應用程序的樣子,非常簡單。當Angular抓取home.html插入到ng-view時,Chrome陷入了無限循環,重新加載頁面直到最終崩潰。這發生在Google App Engine中,但是在WAMP上運行的代碼完全正常。

var app = angular.module('app', ['ngRoute']); 

app.config(function($routeProvider) { 

    $routeProvider 
     // route for the home page 
     .when('/', { 
      templateUrl : "home.html", 
      controller : "mainController" 
     }) 
     .when('/about', { 
      templateUrl : "about.html", 
      controller : "mainController" 
     }) 
     .otherwise({ 
      templateUrl : "home.html", 
      controller : "aboutController" 
     }); 
}); 

的app.yaml

application: activity-tracking 
version: dev 
runtime: python27 
api_version: 1 
threadsafe: false 

handlers: 

- url: /web/components 
    static_dir: web/components 

builtins: 
- remote_api: on 
- deferred: on 

inbound_services: 
- warmup 

libraries: 
- name: django 
    version: "1.2" 

我最好的猜測是,我需要有應用程序引擎忽略角請求獲得一個文件,並永遠只起到了index.html將角將注入。它目前沒有做,導致我的無限循環去/home.html,然後重定向回/index.html

+0

而你的app.yaml?添加了 –

+0

,減去無關的處理程序 –

+0

我認爲您缺少根處理程序。和應用程序來顯示它。 –

回答

3

找到了解決方案,這是相當簡單的,如果其他任何人都絆倒在這。我最初將我的html部分包含在/ web目錄中,後端也在拾取並試圖執行路由並將我指向該html文件。

將我的部分移動到/ static,以便在Angular獲取文件並進行注入時後端不會嘗試路由到該HTML文件。