Angular UI Router在使用grunt构建后不使用模板缓存

rab*_*ble 2 javascript angularjs gruntjs

在使用Grunt构建我的应用程序后,ui.router仍在尝试访问templateUrl URL.由于这些已经被ngTemplates连接起来,这不起作用,我只是得到了一些404错误.

我是新手,并不真正理解我在做什么

$stateProvider
    .state("home", {
      url: "/",
      views: {
        'master': {templateUrl: '/views/main.html'},
        "view-left@home": {
          templateUrl: '/views/list.html'
        },
        "view-right@home": {
          templateUrl: '/views/page.html'
        }
      }
    })
Run Code Online (Sandbox Code Playgroud)

这在我使用grunt服务时有效,但在构建应用程序时会中断

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (main.html, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (page.html, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (list.html, line 0)
Run Code Online (Sandbox Code Playgroud)

如果您需要更多信息,请告诉我,我不确定相关内容.

编辑:

grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
Run Code Online (Sandbox Code Playgroud)

这是我的构建任务.

rab*_*ble 5

我好像修好了.问题是在我的状态中,templateUrl是'/views/main.html',但是在templateCache中它是'views/main.html'(没有第一个斜杠).从templateUrls中删除第一个斜杠修复了该问题.