0

“angular 1.6.1”,“angular-ui-router 0.3.1”,所有 ui 视图都已更改/正常工作,但我在控制台窗口中收到以下错误,我不知道为什么。

在此处输入图像描述

我的 HTML 代码是

<!DOCTYPE html>
<html lang="en" data-ng-app="manoj">
<head>
    <meta charset="UTF-8">
    <title>My App</title>
    <link rel="stylesheet" href="assets/style/angular-material.css">
    <link rel="stylesheet" href="assets/style/materialdesignicons.min.css">
    <link rel="stylesheet" href="assets/style/style.css">
</head>
<body>
<div ui-view class="main-body"></div>

<script src="assets/js/jquery-1.11.3.min.js"></script>
<!--Angular Library-->
<script src="angular/angular.min.js"></script>
<script src="angular/angular-ui-router.min.js"></script>

<script src="angular/angular-animate.min.js"></script>
<script src="angular/angular-aria.min.js"></script>
<script src="angular/angular-messages.min.js"></script>

<!-- Angular Material Library -->
<script src="assets/js/angular-material.min.js"></script>

<!--App Scripts-->
<script src="app/app.js"></script>
<script src="app/dashboard/dashboard.js"></script>
<script src="app/login/login.js"></script>
</body>
</html>

app.js 文件

angular.module('manoj', ['ui.router','ngMaterial'])
    .config(function ($mdThemingProvider, $locationProvider, $stateProvider, $urlRouterProvider) {
        $mdThemingProvider.disableTheming();
        $locationProvider.hashPrefix('');

        $urlRouterProvider.otherwise('/a/dashboard');
        $stateProvider
            .state('login',{
                url:'/login',
                templateUrl:'app/login/index.html',
                controller: 'loginCtrl'
            })
            .state('a',{
                url:'/a',
                templateUrl:'app/app.html'
            })
            .state('a.dashboard',{
                url: '/dashboard',
                templateUrl: 'app/dashboard/dashboard.html',
                controller:'dashboardCtrl'
            });
    }).run(function ($rootScope, $state, $stateParams){
        $rootScope.$state = $state;
        $rootScope.$stateParams = $stateParams;

    });

请有人帮我...

4

1 回答 1

0

您需要更新 ui-router,尝试使用“angular-ui-router 1.0.3”

于 2017-12-15T06:34:25.077 回答