From 4175ab36ca69eb1a0d4497976671909053e8d735 Mon Sep 17 00:00:00 2001 From: Josh Lavely Date: Sun, 13 Nov 2016 21:01:50 -0500 Subject: [PATCH] Fixes Navbar to hide on state change. This was the cleanest way I could find to accomplish this. --- templates/app/client/components/navbar/navbar.component.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/app/client/components/navbar/navbar.component.js b/templates/app/client/components/navbar/navbar.component.js index 8cf2ab0b1..dc13c278f 100644 --- a/templates/app/client/components/navbar/navbar.component.js +++ b/templates/app/client/components/navbar/navbar.component.js @@ -18,7 +18,7 @@ export class NavbarComponent { isCollapsed = true; <%_ if(filters.ngroute || filters.auth) { _%> - constructor(<% if(!filters.uirouter) { %>$location<% } if(!filters.uirouter && filters.auth) { %>, <% } if (filters.auth) { %>Auth<% } %>) { + constructor($scope,<% if(!filters.uirouter) { %>$location<% } if(!filters.uirouter && filters.auth) { %>, <% } if (filters.auth) { %>Auth<% } %>) { 'ngInject'; <%_ if(!filters.uirouter) { _%> this.$location = $location; @@ -34,6 +34,9 @@ export class NavbarComponent { isActive(route) { return route === this.$location.path(); }<% } %> + $scope.$on('$stateChangeSuccess', next => { + this.isCollapsed = false; + }); } export default angular.module('directives.navbar', [])