简体   繁体   中英

Equivilant of rails partials for angularjs

Is there an equivilant of rails partials for angular js.

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.

Does angular have similar functionality?

Yes, you can do it using ngInclude directive.

See the docs and example here: http://docs.angularjs.org/api/ng.directive:ngInclude

You might also want to checkout angular-ui-router module. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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