diff --git a/x-pack/plugins/maps/public/angular/map_controller.js b/x-pack/plugins/maps/public/angular/map_controller.js index 820137225dd7f..2903dc9f2fc4f 100644 --- a/x-pack/plugins/maps/public/angular/map_controller.js +++ b/x-pack/plugins/maps/public/angular/map_controller.js @@ -48,7 +48,7 @@ const app = uiModules.get('app/maps', []); app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage, AppState, globalState, Private) => { - const savedMap = $scope.map = $route.current.locals.map; + const savedMap = $route.current.locals.map; let unsubscribe; inspectorAdapters.requests.reset(); @@ -202,13 +202,18 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage } }); - // TODO subscribe to store change and change when store updates title - chrome.breadcrumbs.set([ - { text: i18n.translate('xpack.maps.mapController.mapsBreadcrumbLabel', { - defaultMessage: 'Maps' - }), href: '#' }, - { text: $scope.map.title } - ]); + const updateBreadcrumbs = () => { + chrome.breadcrumbs.set([ + { + text: i18n.translate('xpack.maps.mapController.mapsBreadcrumbLabel', { + defaultMessage: 'Maps' + }), + href: '#' + }, + { text: savedMap.title } + ]); + }; + updateBreadcrumbs(); addHelpMenuToAppChrome(chrome); @@ -243,6 +248,8 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage 'data-test-subj': 'saveMapSuccess', }); + updateBreadcrumbs(); + if (savedMap.id !== $route.current.params.id) { $scope.$evalAsync(() => { kbnUrl.change(`map/{{id}}`, { id: savedMap.id });