2013-04-21 4 views
1

각도와 레일을 사용하여 어플리케이션을 작성하고 있습니다.서브 링크를 가져 오려고 할 때 각도 + 레일스 앱이 전체 브라우저를 끊습니다.

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에 브라우저 무한 다운로드 자산을 이동하려고 해요 때 나는 내 ApplicationController에서 폴백있다. 왜 그리고 어떻게 수정해야합니까?

+0

내가 같은 문제가 발생하고 –

답변

0

경로 파일에 문제가 있습니다. 당신이 당신의 레일 응용 프로그램의 모든 경로를 잡으려고 할 때 당신은 경로에 /을 추가해서는 안됩니다, 그래서 같이한다 :

match '*any', to: 'controller#method' 

대신

match '/*any', to: 'controller#method'