angularjs中的ui.router问题

时间:2016-11-03 15:57:04

标签: javascript angularjs

我发现了用于构建单页应用程序的ui.router,但是遵循指南:

angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module routerApp due to:(…)(anonymous function) @ angular.js:68(anonymous function) @ angular.js:4640forEach @ angular.js:321loadModules @ angular.js:4601createInjector @ angular.js:4523doBootstrap @ angular.js:1758bootstrap @ angular.js:1779angularInit @ angular.js:1664(anonymous function) @ angular.js:31763trigger @ angular.js:3207defaultHandlerWrapper @ angular.js:3497eventHandler @ angular.js:3485

这是index.html页面:

  <html>
  <head>
    <script src="lib/angular.js"></script>
    <script src="lib/angular-ui-router.js"></script>
    <script src="app.js"></script>

    <style>.active { color: red; font-weight: bold; }</style>
  </head>

  <body ng-app="routerApp">
    <a ui-sref="table">Table</a>

    <div ui-view></div>
  </body>
  </html>

这是app.js:

var routerApp = angular.module("routerApp", ['ui.router']);
routerApp.config('$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
    $urlRouterProvider.otherwise('/');
    $stateProvider
    .state('table', {
        url : '/',
        templateUrl : 'views/table.html'
    });
});

感谢您的帮助,我真的看不到错误..

1 个答案:

答案 0 :(得分:0)

注射应该是一个阵列。

尝试添加这些

{{1}}