如何角JS融入的Grails 2.3.4? [英] How to integrate angular js into grails 2.3.4?
问题描述
我在运行的Grails 2.3.4
虽然关于我的下一个应用程序进行集成angularjs。
I am running on grails 2.3.4
and though about integrating angularjs in my next application.
我觉得从服务器端的最佳方法是使用Grails的 REST
于一体的域和控制器类。
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.
如何获得的Grails与angularjs沟通?(在 index.gsp中
?如果是的话如何将它集成?),这将是一个很好的架构?
How to get grails to communicate with angularjs?(over the index.gsp
?, If so how to integrate it?) What would be a good architecture?
我真的AP preciate你的答案!
I really appreciate your answers!!!
PS:我知道有一个Grails的角度JS插件。不过,我确实看到了使用任何理由!
PS.: I know that there is a grails angular js plugin. However I do see any reason for using that!
推荐答案
我们选择不使用角JS资源插件,但是我们自己,而不是使用。只是在时间和内容更新等更多的灵活性。
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.
只要把angularjs里面的文件/ JS / lib文件夹。创建资源包文件。 (我们的grails-app / conf目录/ AngularResources.groovy文件),如下图所示声明有角的JS资源包。我们宣布我们所有的棱角分明的资源一样,控制器/服务/应用/内AngularResources.groovy指令
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.
这篇关于如何角JS融入的Grails 2.3.4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!