I use slim for my angularjs templates. It took me a long time to figure out how to do this, but it is very easy to do as soon as you know how to do it.
Add a setting of fine pearls and packages.
Make sure you have a template directory. My:
assets/javascripts/templates
Then create the file in config / initializers. My just slim_engine.rb. The name does not matter.
Then the following line is included in this file:
Rails.application.assets.register_engine('.slim', Slim::Template)
Here is a snippet of the route provider that I have that uses one of these templates:
angular.module('customer_app', ['customer_service']) .config(['$routeProvider', function($provider) { $provider.when('/:customer_id/edit/', { templateUrl: '/assets/customers/edit.html.slim', controller: 'CustomersController' }); }]) .config(["$httpProvider", function(provider) { provider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content'); }]);
Full path to the template: assets / templates / clients / edit.html.slim
Hope this helps!
source share