我试图通过源代码学习一些东西,但是当我尝试复制此代码时,却遇到了该错误。
我有一个查看索引,试图从另一个文件夹访问一些.cshtml模板。
@{
ViewBag.Title = "Index";
}
<div ng-controller="inboxIndexCtrl">
<div class="row">
<div class="col-sm-1">
<a ng-href="#/" id="InboxSubNav">Inbox</a>
<hr />
<a ng-href="#/sent" id="InboxSubNav">Sent</a>
<hr />
<a ng-href="#/create" id="InboxSubNav">Create</a>
</div>
<div class="col-sm-11">
<div class="well" ng-view></div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
脚本:
var mail = angular.module('mail', ['ngRoute']);
mail.config([
'$routeProvider', ($routeProvider) => {
$routeProvider.when('/', {
templateUrl: 'Templates/Incoming.cshtml'
})
// Registering path with controller relative to Inbox/Index
// This part is similar to RouteConfig.cs in ASP MVC
.when('/message/:id', {
// Templates are located inside Inbox.
templateUrl: …Run Code Online (Sandbox Code Playgroud)