Reputation: 11
We have Grails 2.4 application which uses AngularJS. We have been using asset-pipeline plugin with Grails 2.4 for handling angularjs files (*.js, *.html angular templates, *.css) located in assets sub-directory of Grails application. I converted this application to Grails 3.3.1. It also uses asset pipeline plugin, version 2.14.2. "com.bertramlabs.plugins:asset-pipeline-grails:2.14.2" .
I cannot make angular to work when I start Grails 3 application using run-app, I keep getting errors in browser console:
angular.js?compile=false:14110 Error: [$compile:tpload] Failed to load template: /DunbarreComm/assets/app/controls/controls.tpl.html (HTTP status: undefined undefined)
DunbarreComm is my application root folder.
It seems to working OK if I build war file and deploy on Tomcat container, it finds angular HTML templates.
How to make Grails application find *.html templates located in various sub-folders of assets folder?
Please note that we do not use "com.craigburke.angular:angular-template-asset-pipeline:2.3.0" plugin. I tried this plugin and I got different errors. Our application works OK with Grails 2.3 with asset pipeline plugin without "angular-template-asset-pipeline", thus I assume it should work OK in Grails 3 without this plugin, just with asset-pipeline plugin.
I did follow very carefully required upgrade steps for Grails 2.4 to Grails 3.
Upvotes: 0
Views: 265
Reputation: 11
I figured what was my issue. I misspelled application name in contextPath variable in application.yml. As soon as I fixed it to the correct value it fixed the issue. Here is what I put to contextPath:
server:
contextPath: /DunbarreComm
DunbarreComm is my application name. Apparently this variable is not used when application is built and deployed as war file, it is used only when application runs using run-app command grails command. Now my application runs OK when I use run-app command and when I deploy war file.
Upvotes: 0