Я делаю базовое приложение, использующее ngRoute. Маршрутизация работает, но мой элемент области внутри моего контроллера не отображается в html.
<p>{{ message }}</p> <!-- Nothing shows -->
<p>{{ message }}X</p> <!-- 'X' shows -->
Скрипты с угловыми, маршрутными, прикладными и регистрационными ссылками указаны в главном html.
<body>
<div class="page">
<main class="cf" ng-view></main>
</div>
</body>
app.js
var myApp = angular.module('myApp', ['ngRoute']);
myApp.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/login', {
templateUrl: 'views/login.html',
contoller: 'RegistrationController'
})
.when('/register', {
templateUrl: 'views/register.html',
contoller: 'RegistrationController'
})
.otherwise({
redirectTo: '/login'
});
}]);
registration.js
myApp.controller('RegistrationController', ['$scope', function ($scope) {
$scope.message = "Welcome to my App!";
}]);
login.html
<section class="card login">
<form name="myform"
novalidate>
<div class="textintro">
<h1>Hi there!</h1>
<p>Log-in to access the awesomeness!</p>
<p>{{ message }}</p>
</div>
<fieldset>
<input type="email" name="email" placeholder="Email">
<input type="password" name="password" placeholder="Password">
</fieldset>
<button type="submit" class="btn">Login</button>
<p>or <a href="#/register">register</a></p>
</form>
</section>
Это опечатка:
contoller: 'RegistrationController'
должно быть:
controller: 'RegistrationController'
console.log("RegistrationController");
прямо над$scope.message = ...
она отображается в консоли?