【发布时间】:2014-10-23 10:30:44
【问题描述】:
在我的 Angular 应用程序中,我创建目录 /app/assets/javascripts/angular/templates 来创建我的视图。
我的 route.js.coffe
app.config ($routeProvider) ->
$routeProvider
.when('/task', {
templateUrl: 'templates/task/index.html'
controller: 'TaskCtrl'
})
我的 index.slim
.container
h2
|What would you like to do?
a href="#/watchlist"
| Watchlist
|   or  
a href="#/task"
| Task
div class="row" ng-view=""
当我单击“任务”链接时,什么也没有发生。我在控制台上看到以下消息:
在 2014-08-29 08:49:17 -0300 开始为 192.168.1.106 获取“/templates/task/index.html” ActionController::RoutingError (没有路由匹配 [GET] "/templates/task/index.html"):
我的 index.html:
<div ng-controller="TaskCtrl">
<h2>teste</h2>
</div>
还有我的 route.rb
Rails.application.routes.draw do
get 'home/index'
scope :api, defaults: {format: :json} do
resources :tasks
resources :stocks
end
root 'home#index'
end
【问题讨论】:
-
如何将应用绑定到您的应用?