Grails Asset-pipe does not load partial angular templates

Im using angular -ui-bootstrap with Grails 2.3.x plugin: 1.6.1 plugin. One component is alert.js trying to load /template/alert/alert.html, but this resolves to 404.

I tried to include grails.assets.includes = [* /. html], did not help.

Any workaround for this? Anyway, to allow the resource pipeline to include partial patterns?

+6
source share
3 answers

It is a template in assets, if you remember that the first level folders inside the assets are smoothed, so you may want to nest your templates one level or change your path.

+2
source

I tried putting the / partials directory in / web application. It ends like this:

/web-app/partials/content.html

I do not need to bother with the conveyor, it just works!

Used Versions:

  • Grails: 2.4.2
  • compile ": resource-pipe: 1.8.11"

Hope this helps anyone upgrading Grails.

+2
source

Thank you for your excellent blog on AngularJS and Grails , which accelerated me on this topic.

As for partial, I assume that the assets directory is not suitable for their placement, because they are concatenated and minimized in the operating mode.

Instead, I use GSP templates as partial parts of AngularJS. For example, I have

view / overtones / login.gsp

 <div>Hello World!</div> 

CONF / UrlMappings.groovy

 static mappings = { ... '/partials/login'(view:'/partials/_login') } 

Grails app / assets / javascript /

 ... templateUrl: 'partials/login', ... 

Advantage: you can use let script and taglib in partial files.

An alternative to using GSP directly would be James Clay's approach in this thread .

Regards, Bjorn

+2
source

All Articles