3

I'm trying to set up a demo angular app but for some reason my partial (partials/test.html) content isn't loading into the layout file. Here's the index.html:

<!DOCTYPE html>
<html lang="en" ng-app="btq">
   <head>
      <meta charset="utf-8" />
      <title>NgView Test</title>
   </head>
   <body>
      <p>Some stuff on the page.</p>
      <div ng-view></div>
      <script src="js/angular.js"></script>
      <script src="js/app.js"></script>
   </body>
</html>

AngularJS is version 1.0.7. app.js contains the following:

'use strict';

// Declare app level module which depends on filters, and services
angular.module('btq', []).
  config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/dashbaord', {templateUrl: 'partials/test.html', controller: 'DashboardCtrl'});
    $routeProvider.otherwise({redirectTo: '/dashboard'});
  }]);

/* Controllers */

angular.module('btq.controllers', []).
  controller('DashboardCtrl', [function() {

  }]);

I'm obviously missing something simple. Any help would be appreciated!

4

2 回答 2

2

可能是因为“错字”。您在这里写了“dashbaord”而不是“dashboard”:

$routeProvider.when('/dashbaord' , ...
于 2013-06-09T09:01:30.960 回答
1

改变

angular.module('btq.controllers', [])

angular.module('btq')

否则这会在您的app.js

于 2013-06-09T09:07:07.053 回答