我正在使用Rails中的Angular和后端创建Web应用程序前端。
我应该使用Angular中的所有视图,但我无法对landing_page
,sign_up
和log_in
页面等某些视图执行操作,因为我需要使用设计。
home.html.erb是一个目标网页,用户首次访问我的网络应用时会被定向到该目标网页。当他们点击导航栏上的contact
时,它会开始呈现角度视图并显示,因为contact
视图是由Angular构成的。渲染的逻辑在application_controller
如下所示:
def home
if current_user
render :file => 'public/index.html', :layout => false and return
else
if request.url == "#{request.base_url}/contact"
render :file => 'public/index.html', :layout => false and return
else
render :file => '/pages/home.html.erb'
end
end
end
route.rb设置:
root 'application#home'
如果用户未登录并点击contact
视图,则会呈现index.html
,这是Angular视图。和Angular路由到/contact/
并显示适当的视图。
Contact.html如下:
<header class="page-header">
<div class="page-inner">
<a href="/" class="page-header-logo"><img src="/assets/logo-green.svg" alt="logo"></a>
</div>
</header>
<body>
//the view
<body>
当用户点击contact
视图中的徽标时,它会返回landing_page
并开始杀死home.html.erb中的css。一些CSS未正确加载并最终更改字体和字体颜色。为什么会这样?