我的MVC网页有两个“信息中心”和“ ManageClient ”页面的链接。
当我直接将路径路径设置为我的AngularJS页面(ManageClient)时,我的“新客户端”模板完全显示在<div ng-view="">
中。
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "SubMClientManagement", action = "ManageClient", id = UrlParameter.Optional }
);
>>>> link in browser : http://localhost:55542/#/newClient
BUT;
如果我将其设置为Dashboard,并转到ManageClient页面并单击newClient按钮,它将无法正常工作
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "SubMClientManagement", action = "Dashboard", id = UrlParameter.Optional },
//defaults: new { controller = "SubMClientManagement", action = "ManageClient", id = UrlParameter.Optional }
);
>>>> link in browser : http://localhost:55542/SubMClientManagement/ManageClient/#/newClient
FYI
昂。 route config:
ClientMngModel.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
//$locationProvider.html5Mode(true);
$routeProvider
.when("/newClient", {
controller: "NewClientController",
templateUrl: "Templates/ClientMngTemp/NewClient.html"
})
.when("/deleteClient", {
controller: "DeleteClientController",
templateUrl: "Templates/ClientMngTemp/DeleteClient.html"
})
.when("/updateClient", {
controller: "EditClientController",
templateUrl: "Templates/ClientMngTemp/UpdateClient.html"
})
.otherwise({ redirectTo: "/" });
}]);
<小时/> 在视图中:SubMClientManagement / ManageClient.cshtml
<a href="#/newClient" class="btn btn-info btn-circle btn-lg"><i class="fa fa-plus"></i></a>
<小时/> 版本: angularjs.1.2.27 Mvc 4.0