Angularjs 带MVC束的OCLazyLoad
我使用MVC绑定来绑定JS文件:Angularjs 带MVC束的OCLazyLoad,angularjs,oclazyload,Angularjs,Oclazyload,我使用MVC绑定来绑定JS文件: bundles.Add(new ScriptBundle("~/bundles/essentialjs").Include( "~/Scripts/spa/features/exception/exceptionModule.js", "~/Scripts/spa/features/exception/controllers/e
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' }
您是否尝试过使用
/bundles/essentialjs
。不确定~/
是否是有效的url。。。如果您想引用当前目录,您需要使用/bundles/essentialjs
您的意思是在BundleConfig和Angular中都更改它以使用/bundles/essentialjs
?是的……两个位置都可以,尽管我不确定您的bundle。它确实有一些奇怪的.net语法。。所以我猜只能在UI路由器状态下更改它