我想在asp .net mvc中合并角度路由。任何人都可以帮我这么做
我的app文件如上所示我有区域仪表板和仪表板mvc视图和控制器。我想创建一个菜单作为流程
html page
<ul>
<li> <a href="#dashboard"> dashboard page </a></li>
<li><a href="#Areas/areadashboard"> areaDashboard </a> </li>
</ul>
app.js文件
var app = angular.module('myApp' , ['ngRoute']);
app.app.config(function ($routeProvider) {
$routeProvider
.when('/dashboard1', {
templateUrl: 'Dashboard1',
controller: 'dashCtrl'
})
.when('/area1/area1dashboard', {
templateUrl: 'Area1/Area1Dashboard',
controller: 'areaDashCtrl'
})
.otherwise({
redirectTo: ''
}); }).controller('dashCtrl' , function($scope){
$scope.message =" this is dashboard controller";
}).controller('areaDashCtrl' , function($scope){
$scope.message =" this is area dashboardcontroller";
});
仪表板/ index.cshtml
<script type="text/ng-template" id="Dashboard1">
<div ng-controller="dashCtrl">
{{message}}
</div>
area1 / area1Dashboard / index.cshtml文件
<script type="text/ng-template" id="Area1/Area1Dashboard">
<div ng-controller="areaDashCtrl">
{{message}}
</div>
</script>
我得到这样的错误
Error: [ng:areq] http://errors.angularjs.org/1.4.5/ng/areq?p0=dashCtrl&p1=not%20aNaNunction%2C%20got%20undefined
at Error (native)
at http://localhost:3376/Scripts/angular.min.js:6:416
at pb (http://localhost:3376/Scripts/angular.min.js:22:41)
at Sa (http://localhost:3376/Scripts/angular.min.js:22:128)
at http://localhost:3376/Scripts/angular.min.js:80:25
at link (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular-route.min.js:7:180)
at $ (http://localhost:3376/Scripts/angular.min.js:73:46)
at L (http://localhost:3376/Scripts/angular.min.js:61:495)
at g (http://localhost:3376/Scripts/angular.min.js:54:326)
at http://localhost:3376/Scripts/angular.min.js:53:388(anonymous function) @ angular.min.js:107(anonymous function) @ angular.min.js:80$ @ angular.min.js:73L @ angular.min.js:61g @ angular.min.js:54(anonymous function) @ angular.min.js:53(anonymous function) @ angular.min.js:55m @ angular.min.js:60v @ angular-route.min.js:6m.$broadcast @ angular.min.js:135(anonymous function) @ angular-route.min.js:11(anonymous function) @ angular.min.js:118m.$eval @ angular.min.js:132m.$digest @ angular.min.js:129m.$apply @ angular.min.js:133g @ angular.min.js:87L @ angular.min.js:91A.onload @ angular.min.js:92