2014-04-03 120 views
1

我有一個SPA anularjs應用程序幾頁。Angularjs路由手動刷新

路由器提供的配置如下:

$locationProvider.html5Mode(true); 

var path = 'web/partials/views/'; 
$routeProvider 
     .when('/', { 
      templateUrl: path + 'home.html', 
      //controller: 'mainController' 
     }) 
     .when('/benefits', { 
      templateUrl: path + 'benefits.html', 
      //controller: 'aboutController' 
     }) 
     .when('/gallery', { 
      templateUrl: path + 'gallery.html', 
      //controller: 'contactController' 
     }) 
     .when('/quote', { 
      templateUrl: path + 'quote.html', 
      //controller: 'contactController' 
     }); 

此工程 - 想起index.html的工作和地址欄導航鏈接獲取正確的URL(myapp.com/benefits,myapp.com/quote,等等)

不起作用的是直接進入myapp.com/quote或myapp.com/benefits或其他頁面。我得到「資源不存在」 - 這是有道理的 - 資源真的不存在。

我的問題是什麼是處理這個我AngularJS的適當方式?

謝謝!

回答