I'm facing an issue with my meta controller, as I am trying to alter the meta tags dynamically. When checking the console, I encounter the error message error ng areq not a function
. I have looked on StackOverflow for similar issues but couldn't find a solution that fits my problem. Below are the relevant HTML tags:
<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;
});