feat(platforms): Android and iOS Specific Styles and Transitions

This commit is contained in:
Max Lynch
2014-06-11 16:48:53 -05:00
parent 8476f0cb3a
commit c30be67f65
19 changed files with 823 additions and 107 deletions

View File

@@ -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');