从 Yeoman Angular 脚手架进行基本安装,在整个生命周期中,我无法让路由器加载基本模板。这是我的设置
// 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
消息。我觉得我已经尝试了每一种组合。