我正在开发一个强类型的Angular2和MVC6项目。想法是使用 Razor + Angular 。
当我尝试
时 bootstrap(MainComponent, [CloudDBProvider]);
//期望MVC控制器加载Index.cshtml
我收到错误
templateUrl : 'Home/Index'
另一方面,当我在_ view.cshtml 中评论布局部分时,它可以正常工作(我仍然看到加载子路由的问题)。在 Index.cshtml 而不是 _Layout.cshtml 中加载angular2依赖项(也尝试其他方式)。
但是,当我引用一个普通的HTML文件时,它可以工作。
Potentially unhandled rejection [3] t@http://localhost:41860/lib/angular2/bundles/angular2.min.js:6:5082
_</e.prototype.normalizeLoadedTemplate@http://localhost:41860/lib/angular2/bundles/angular2.min.js:15:19192
_</e.prototype.normalizeTemplate/<@http://localhost:41860/lib/angular2/bundles/angular2.min.js:15:18927
//这没有错误。
当我使用角度 0.46 aplha 时,我没有遇到此错误,并且在将其升级为角度 2.0 Beta 之后我看到了这一点。
寻找一些意见!