I used to keep my angular templates in public folder but I need to add some ruby in my views, so I'd like to put them in assets/templates using angular-rails-templates. However, and after following documentation, I can't manage to make it work. Here's my code :
assets/javascript/application.js
//= require jquery
//= require jquery_ujs
//= angular/angular.min
//= angular/angular-route.min
//= angular/angular-resource.min
//= require angular-rails-templates
//= require_tree ../templates
//= angular/main
//= require_tree .
assets/javascript/angular/main.js
var myApp = angular.module('myApp', [
'templates',
'ngRoute',
'articleController',
'basketService'
]);
myApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider
.when('/articles/categories/type', {
controller: 'categoryTypeCtrl',
templateUrl: 'articles_view.html'
})
views/layout/articles.html.haml
!!! 5
%html{'ng-app' => 'myApp'}
%head
%base{:href => '/'}
%title FilterApp
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
= csrf_meta_tags
%body#articles
=render "shared/details_header"
#articles_container.container-fluid
.row
%div{'ng-view' => ''}
=render "shared/footer"
I've added gem 'sprockets', '2.12.3'
to my gemfile as explained here but still I can't render articles_view.html, only the layout. So does anybody see something I'm missing ? Thanks for your time.