简体   繁体   English

AngularJS的Rails局部视图

[英]Equivilant of rails partials for angularjs

Is there an equivilant of rails partials for angular js. 是否有角度js的rails部分等效。

Ex: in rails I have my application.html.erb and I can do <%= render 'layouts/_header and it will render that header for every page. 例如:在rails中,我有我的application.html.erb ,我可以做<%= render 'layouts/_header ,它将为每个页面渲染该标题。

Does angular have similar functionality? Angle是否具有类似的功能?

Yes, you can do it using ngInclude directive. 是的,您可以使用ngInclude指令来实现。

See the docs and example here: http://docs.angularjs.org/api/ng.directive:ngInclude 请在此处查看文档和示例: http : //docs.angularjs.org/api/ng.directive : ngInclude

You might also want to checkout angular-ui-router module. 您可能还需要检出angular-ui-router模块。 It allows you to do nested and parallel views. 它允许您执行嵌套和并行视图。 It is great, flexible, easy to use and well documented. 它很棒,灵活,易于使用并且有据可查。 https://github.com/angular-ui/ui-router https://github.com/angular-ui/ui-router

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM