首页 > 解决方案 > 带有 MVC 捆绑包的 OCLazyLoad

问题描述

我使用 MVC 捆绑来捆绑 JS 文件:

bundles.Add(new ScriptBundle("~/bundles/essentialjs").Include(
                                  "~/Scripts/spa/features/exception/exceptionModule.js",
                                  "~/Scripts/spa/features/exception/controllers/errorController.js"                    
            ));

我需要使用 OCLazyLoad 加载这些 MVC 包。我尝试了下面的代码,但找不到捆绑包的 404。

.state('test',
      {
        url: "/login",
        templateUrl: "scripts/test.html",
        resolve: {
          plugins: ['$ocLazyLoad', function ($ocLazyLoad) {
            console.log('oczload');
            return $ocLazyLoad.load([
              { type: 'js', path: '~/bundles/essentialjs' }
            ]);
          }]
        }
      })

问题似乎在这一行:

 { type: 'js', path: '~/bundles/essentialjs' }

标签: angularjsoclazyload

解决方案


推荐阅读