Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions js/ext/angular/src/directive/ionicViewState.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
updateHeaderData(data);
});

$rootScope.$on('viewState.titleUpdated', function(e, data) {
$scope.currentTitle = (data && data.title ? data.title : '');
});

// If a nav page changes the left or right buttons, update our scope vars
$scope.$parent.$on('viewState.leftButtonsChanged', function(e, data) {
$scope.leftButtons = data;
Expand Down Expand Up @@ -198,10 +202,16 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
$scope.$emit('viewState.rightButtonsChanged', $scope.rightButtons);
});

// watch for changes in the title
var deregTitle = $scope.$watch('title', function(val) {
$scope.$emit('viewState.titleUpdated', $scope);
});

$scope.$on('$destroy', function(){
// deregister on destroy
deregLeftButtons();
deregRightButtons();
deregTitle();
});

};
Expand Down