1
我試着開始與yeoman開發角度的應用。這聽起來可能很愚蠢,但我在使用yo:angular route創建路線時遇到了問題。Yeoman和角度 - 路由不起作用
當我創建一個使用新的路徑:
yo:angular route foo
自耕農創建:
app/scripts/controllers/foo.js (controller)
app/views/foo.html (view)
app/test/spec/controllers/foo.js (testing the controller)
在app.js它創建:
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/foo', {
templateUrl: 'views/foo.html',
controller: 'FooCtrl'
})
.otherwise({
redirectTo: '/'
});
});
所以一切都應該很好地工作。不幸的是,路線不工作 - 當我嘗試打開
http://localhost:9000/foo
我獲得以下錯誤:
Cannot GET /foo
在自耕農路線的想法看起來很簡單,我不知道問題出在哪裏。
你如何爲你的應用程序提供服務?節點/阿帕奇/ nginx的/ ..?嘗試在主頁上建立到'/ foo'的鏈接並從主頁訪問它 – doodeec