0

I'm working with Rails(4.2) + AngularJS. Here templates fall under two category, one which is directly referenced from config.js.erb

 .when('/users', {
        templateUrl: '<%= asset_path("users.html") %>',
        controller: UserListCtrl
      })

Templates are handled properly in production and precompiled version of users template is loaded.

Others being called from inside the template like

<pane ng-if="$index == 0" ng-form name="chm_standard" pane-form="details.form.routing.call_handling_mode.chm_standard" heading="{{global.chm_types[0].Description}}">
   <div ng-include="'/assets/chm.html'"></div>
</pane>

chm.html.erb in dev mode is fetched from app/assets/javascripts/templates/en/chm.html. This gives an error, "Template not found" in production since i have

chm-fer342xx.html in public/assets/javascripts/templates

How can this be handled, is moving all templates to public/ folder only option available?

Bijendra
  • 9,467
  • 8
  • 39
  • 66
  • Maybe it is answer to your question - https://stackoverflow.com/questions/12116476/rails-static-html-template-files-in-the-asset-pipeline-and-caching-in-developmen? – stepozer Jan 23 '19 at 11:41

1 Answers1

0

When using ng-include angular would then only load from a trusted resource.

Possibly the browser is blocking due to CORS restrictions.

tomerpacific
  • 4,704
  • 13
  • 34
  • 52