mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
update how view's set titles, closes #337
This commit is contained in:
16
js/ext/angular/src/directive/ionicViewState.js
vendored
16
js/ext/angular/src/directive/ionicViewState.js
vendored
@@ -102,12 +102,9 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
|
||||
$element.addClass($scope.type);
|
||||
|
||||
var updateHeaderData = function(data) {
|
||||
var oldTitle = $scope.currentTitle;
|
||||
$scope.oldTitle = oldTitle;
|
||||
$scope.oldTitle = $scope.currentTitle;
|
||||
|
||||
if(typeof data.title !== 'undefined') {
|
||||
$scope.currentTitle = data.title;
|
||||
}
|
||||
$scope.currentTitle = (data && data.title ? data.title : '');
|
||||
|
||||
$scope.leftButtons = data.leftButtons;
|
||||
$scope.rightButtons = data.rightButtons;
|
||||
@@ -125,7 +122,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
|
||||
$element[0].classList.remove('reverse');
|
||||
}
|
||||
|
||||
animate($scope, $element, oldTitle, data, function() {
|
||||
animate($scope, $element, $scope.oldTitle, data, function() {
|
||||
hb.align();
|
||||
});
|
||||
} else {
|
||||
@@ -174,6 +171,12 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
|
||||
tElement[0].removeAttribute('title');
|
||||
|
||||
return function link($scope, $element, $attr) {
|
||||
|
||||
$rootScope.$broadcast('viewState.viewEnter', {
|
||||
title: $scope.title,
|
||||
navDirection: $scope.$navDirection || $scope.$parent.$navDirection
|
||||
});
|
||||
|
||||
// Should we hide a back button when this tab is shown
|
||||
$scope.hideBackButton = $scope.$eval($scope.hideBackButton);
|
||||
if($scope.hideBackButton) {
|
||||
@@ -321,6 +324,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
|
||||
current = $state.current;
|
||||
|
||||
viewScope = current.scope = scope.$new();
|
||||
viewScope.$navDirection = transitionOptions.navDirection;
|
||||
|
||||
if (locals.$$controller) {
|
||||
locals.$scope = viewScope;
|
||||
|
||||
5
js/ext/angular/src/service/ionicView.js
vendored
5
js/ext/angular/src/service/ionicView.js
vendored
@@ -357,11 +357,6 @@ angular.module('ionic.service.view', ['ui.router'])
|
||||
}
|
||||
opts.parentElement.append(opts.enteringElement);
|
||||
}
|
||||
|
||||
$rootScope.$broadcast('viewState.viewEnter', {
|
||||
title: (opts.enteringScope ? opts.enteringScope.title : null),
|
||||
navDirection: (opts.navDirection ? opts.navDirection : null)
|
||||
});
|
||||
|
||||
function getAnimationClass(){
|
||||
// go up the ancestors looking for an animation value
|
||||
|
||||
Reference in New Issue
Block a user