user2051347 user2051347 - 7 months ago 52
AngularJS Question

How to integrate angular js into grails 2.3.4?

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
integration in the domain and controller classes.

However here I am stuck.

How to get grails to communicate with angularjs?(over the
?, 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!


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.