從Yeoman角形腳手架進行基本安裝,並且爲了使用壽命,我無法讓路由器加載基本模板。這裏是我的設置Yeoman/Angular/Coffee.when()路由器不會路由 - 不能GET
// index.html
<body ng-app="mvmdApp">
<div class="container" ng-view=""></div>// not sure how ng-view plays into this
// app.coffee
myAppModule = angular.module("mvmdApp", [])
.config(($routeProvider, $locationProvider) ->
$locationProvider.html5Mode true
$routeProvider
.when("/",
templateUrl: "views/main.html"
controller: "MainCtrl"
)
.when("/youtube",
templateUrl: "views/youtube.html"
controller: "YoutubeCtrl"
)
)
// main.js
angular.module('mvmdApp')
.controller 'MainCtrl', ($scope) ->
$scope.awesomeThingss = [
'HTML5 Boilerplate'
'AngularJS'
'Karma'
]
$scope.youtube = ($scope) ->
alert 'hi'
.controller "YoutubeCtrl", ($scope) ->
alert 'Work!'
// views/youtube.html
<div class="youtube-unit">
<div class="outer-frame">
<div class="inner-frame">
<iframe width="560" height="315" src="//www.youtube.com/embed/2FNEiTjcMM0" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
</div>
</div>
</div>
主控制器加載罰款,我至三儘可能地複製它
去localhost:9000/youtube給我一個Cannot GET /youtube
消息。我覺得我已經嘗試了各種組合。
看起來很簡單,謝謝! –