小编ng-*_*app的帖子

如何设置Grails和AngularJS部分模板

我正在实现一个项目,使用AngularJS作为前端,Grails作为后端.

  • Angular JS =>单页面应用程序
  • Grails => REST API将在WebApp本身和第三方应用程序中使用.

这就是我设置项目的方式:

web-app
   |
   |_____ js ( angular controllers, modules, partial templates.)
   |
   |_____ images
   |
   |_____ css


grails-app
   |
   |_____ views ( in here I have my main view, the one I use at the first user request )
Run Code Online (Sandbox Code Playgroud)

我不是使用Resources插件,而是使用Grunt构建自己的前端,然后我只链接布局本身内的最终文件.

js在web-app中构建了文件夹,以包含一个partials文件夹,其中包含要在AngularJS中调用的所有部分模板

这是加载视图的非常标准的角度代码:

angular.module('myapp', []).
  config(['$routeProvider', function($routeProvider) {
  $routeProvider
    .when('/invoices', {
        templateUrl: 'partials/invoices-list.html',   
        controller: InvoiceListCtrl
    })
    .when('/invoices/:invoiceId', {
        templateUrl: 'partials/invoice-details.html', 
        controller: InvoiceDetailCtrl}
    )
    .otherwise({redirectTo: '/dashboard'}, {
        templateUrl: …
Run Code Online (Sandbox Code Playgroud)

javascript java grails grails-plugin angularjs

5
推荐指数
1
解决办法
4453
查看次数

标签 统计

angularjs ×1

grails ×1

grails-plugin ×1

java ×1

javascript ×1