Hoping someone can help out an AngularJS noob!
I've set up a basic site with routing to change pages. All these pages have a persistent menu that interacts with the DOM to toggle classes on/off. The issue i'm having is that on initial page load, the click function works on the "Home" page, but when I navigate away to "Blog" the function stop working:
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when("/", {templateUrl: "partials/home.html", controller: "PageCtrl"})
.when("/blog", {templateUrl: "partials/blog.html", controller: "PageCtrl"})
}]);
app.controller('PageCtrl', function (/* $scope, $location, $http */) {
$('#works-navigation .navigation-label').click(function () {
$('body').toggleClass('show-works-navigation');
});
});
Any ideas?!