How can I use the custom templates of angular ui bootstrap in rails?
I mean, if I use pagination
for example it will look for a templates/pagination/pagination.html
template.
The problem is that rails won't serve templates in that path, it actually needs to be assets/templates/pagination/pagination.html
using the <%= asset_path(....) %>
helper.
Hacking the angular ui bootstrap javascript file is a way, but I don't feel like hacking it every time I get a new version.
While some of the AngularJS Bootstrap templates come exclusively for admins and dashboards, the others are for websites. Apzel is a perfect example of a powerful bundle of goodies for app and software websites. The set of six home designs and multiple practical internal pages covers all the necessary for you to start immediately.
Say that you want to add custom CSS files in your Rails app. Here are the steps that worked for me: Now you have to put the following line inside the <head> tag in the app/layouts/application.html.erb : And that's it. You don't even need to restart the server jut refresh the page.
For Angular 2 support, check out ng-bootstrap , created by the UI Bootstrap team. This repository contains a set of native AngularJS directives based on Bootstrap's markup and CSS. As a result no dependency on jQuery or Bootstrap's JavaScript is required.
Make the development process fun – with an AngularJS template! ArchitectUI is one of the more versatile dashboard templates available on the market. It includes nine main layouts along with multiple other page layouts and 100s of components. You can also pick from numerous preset color skins, finding the right one for your project much easier.
What I would suggest is to bundle custom templates with the library itself or inside a separate file. The technique to use is to fill in $templateCache
with the content of your custom templates. Have a look at one of the files distributed with tamplates to see what I mean:
https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-tpls-0.3.0.js#L2042
You can bundle templates into the $templateCache
as part of the build process or prepare this file manually (in this case you need to write templates as JS strings).
Downloading individual templates via XHR for each and every directive would be wasteful as it would result in many XHR requests and would slow down your application. Also, if you preload templates into the $templateCache
you can specify required path, one that doesn't need to be a valid path on your WWW server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With