mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(platforms): Android and iOS Specific Styles and Transitions
This commit is contained in:
18
js/angular/directive/navBackButton.js
vendored
18
js/angular/directive/navBackButton.js
vendored
@@ -64,7 +64,11 @@ IonicModule
|
||||
.directive('ionNavBackButton', [
|
||||
'$animate',
|
||||
'$rootScope',
|
||||
function($animate, $rootScope) {
|
||||
'$sanitize',
|
||||
|
||||
'$ionicNavBarConfig',
|
||||
|
||||
function($animate, $rootScope, $sanitize, $ionicNavBarConfig) {
|
||||
var backIsShown = false;
|
||||
//If the current viewstate does not allow a back button,
|
||||
//always hide it.
|
||||
@@ -76,7 +80,15 @@ function($animate, $rootScope) {
|
||||
require: '^ionNavBar',
|
||||
compile: function(tElement, tAttrs) {
|
||||
tElement.addClass('button back-button ng-hide');
|
||||
|
||||
return function($scope, $element, $attr, navBarCtrl) {
|
||||
console.log($attr.textFromTitle);
|
||||
|
||||
// Add a default back button icon based on the nav config, unless one is set
|
||||
if($element[0].className.indexOf('ion-') < 0) {
|
||||
$element.addClass($ionicNavBarConfig.backButtonIcon);
|
||||
}
|
||||
|
||||
if (!$attr.ngClick) {
|
||||
$scope.$navBack = navBarCtrl.back;
|
||||
$element.on('click', function(event){
|
||||
@@ -85,10 +97,12 @@ function($animate, $rootScope) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//Make sure both that a backButton is allowed in the first place,
|
||||
//and that it is shown by the current view.
|
||||
$scope.$watch(function() {
|
||||
if(isDefined($attr.fromTitle)) {
|
||||
$element[0].innerHTML = '<span class="back-button-title">' + $sanitize($scope.oldTitle) + '</span>';
|
||||
}
|
||||
return !!(backIsShown && $scope.backButtonShown);
|
||||
}, ionic.animationFrameThrottle(function(show) {
|
||||
if (show) $animate.removeClass($element, 'ng-hide');
|
||||
|
||||
Reference in New Issue
Block a user