我试图让我的元控制器动态更改元标记,但在控制台中我得到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