我正在使用 Angular 和 Rails 编写应用程序。我有后备ApplicationController
:
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :intercept_html_requests
private
def intercept_html_requests
render('pages/index') if request.format == Mime::HTML
end
end
和路由器一样:
betly.config(function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider.when('/', {
templateUrl: 'assets/tournaments.html',
controller: 'tournamentController'
}).when('/aaa', {
templateUrl: 'assets/tournaments.html',
controller: 'tournamentController'
}).when('/matches/:matchId',{
templateUrl: 'assets/matchDetails.html',
controller: 'matchController'
}).otherwise({
redirectTo:'/'
});
});
views/layouts/application.html.erb
:
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset='utf-8' />
<title>BetLy</title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
<%= javascript_include_tag "application" %>
</body>
</html>
当我试图去/matches/10
浏览器无限下载资产时。为什么以及如何解决这个问题?