我試圖讓我的元控制器動態更改元標記,但在控制檯中我得到error ng areq not a function
。我通過StackOverflow搜索類似的問題,但沒有解決方案是爲我的問題。我在我的HTML,這些標籤:AngularJS錯誤代碼不是函數
<html ng-app="WebApp" >
<head ng-controller="MetaDataCtrl">
<meta name="description" content="{{ meta.tags.description }}">
</head>
<body >
<div ng-include='"templates/header.html"'></div>
<div ng-view></div>
</body>
</html>
Main.js
var app = angular.module('WebApp', [
'ngRoute'
]);
/**
* Configure the Routes
*/
app.config(['$routeProvider', '$locationProvider', function($routes, $location) {
$location.html5Mode(true).hashPrefix('!');
$routes
// Home
.when("/", {templateUrl: "partials/home.html",
controller: "PageCtrl",
metadata: {
title: 'This is my title',
description: 'This is Desc.' }
})
}]);
app.controller('PageCtrl', function (/* $scope, $location, $http */) {
});
.controller('MetadataCtrl', function ($scope, metadataService) {
$scope.meta = metadataService;
});
你能把metadataService –
的代碼,我沒有任何代碼它。我在網上編譯了各種教程的代碼。我是否需要代碼,我認爲角處理元數據服務。 – user3187715
你的構建過程是什麼?你是否縮小了你的代碼? – LordTribual