How to integrate angular js into grails 2.3.4?
angularjs, grails, grails-2.0, grails-plugin, javascript
Solution
We chose to not to use angular-js resources plugin, but instead use on our own. Just for more flexibility on when and what to update etc.
Just put the angularjs files inside /js/lib folder. Create a resource bundle file. (we have grails-app/conf/AngularResources.groovy file) and declare your angular js resource bundles there as shown below. We declared all our angular resources, like, controllers/services/apps/directives inside AngularResources.groovy
modules = {
'angular' {
resource url:"js/lib/angular/angular.min.js", nominify:true
resource url:"js/lib/angular/angular-resource.min.js", nominify:true
}
}
Require the module on the screen where you want to use it.
Problem
I am running on `grails 2.3.4` and though about integrating angularjs in my next application. I think the best way from the server side is to use grails `REST` integration in the domain and controller classes. However here I am stuck. How to get grails to communicate with angularjs?(over the `index.gsp`?, If so how to integrate it?) What would be a good architecture? I really appreciate your answers!!! PS.: I know that there is a grails angular js plugin. However I do see any reason for using that!