I am getting unidentified on my function when trying to set the <h1>
based on a function using the URL string. This is my code so far, I would set it up in Plunker, but is a little awkward as there I can't replicate a URL change:
angular.module('app').controller('NavCtrl', function($scope, $location) {
// Create <h1> based on url string
var pageUrl = $location.url().substring(1);
$scope.pageTitleItems = {
feedback: "Feedback",
settings: "Settings",
editprofile: "Edit Profile"
};
$scope.$watch('$scope.location.url()', function(newValue, oldValue, $location) {
$scope.pageTitle = $scope.pageTitleItems.pageUrl;
console.log($scope.pagetitle);
});
});
Does anyone know what I am doing wrong here?!