我正在实现一个项目,使用AngularJS作为前端,Grails作为后端.
这就是我设置项目的方式:
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)