静的ヘッダーとフッター レイアウトのページを作成しようとしていますが、ng-view または ng-include を使用して、URL に基づいてコンテナー テンプレートを変更しています。私は2つの方法を試しました:
$routeProvider の使用:
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/', {
template: 'views/home.html',
controller: 'Ctrl',
});
$routeProvider.when('/contact-us', {
template: 'views/contact.html',
controller: 'Ctrl',
});
$routeProvider.otherwise({
redirectTo: '/'
});
}]);
または、テンプレート URL を返すコントローラー関数:
app.controller('locationCtrl', function ($scope, $location, $routeParams) {
$scope.templateUrl = function() {
return "/views/home.html";
}
});
ただし、どちらの場合でも、お問い合わせエラー メッセージを取得できません。