Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(layout): allow layout-align without cross-axis value #6003

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion docs/app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ function($scope, $attrs, $location, $rootScope) {
direction: 'row'
};
$scope.layoutAlign = function() {
return $scope.layoutDemo.mainAxis + ' ' + $scope.layoutDemo.crossAxis;
return $scope.layoutDemo.mainAxis +
($scope.layoutDemo.crossAxis ? ' ' + $scope.layoutDemo.crossAxis : '')
};
}])

Expand Down
1 change: 1 addition & 0 deletions docs/app/partials/layout-alignment.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<div>
<md-subheader>Alignment in Perpendicular Direction ({{layoutDemo.direction == 'column' ? 'horizontal' : 'vertical'}})</md-subheader>
<md-radio-group ng-model="layoutDemo.crossAxis">
<md-radio-button value=""><em>none</em> (use default)</md-radio-button>
<md-radio-button value="start">start</md-radio-button>
<md-radio-button value="center">center</md-radio-button>
<md-radio-button value="end">end</md-radio-button>
Expand Down
4 changes: 2 additions & 2 deletions src/core/services/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@
cross: "stretch"
};

var values = (value || "").replace(WHITESPACE, "-").split("-");
if ( values.length == 3 ) {
var values = (value || "").toLowerCase().replace(WHITESPACE, "-").split("-");
if ( values[0] === "space" ) {
values = [ values[0]+"-"+values[1],values[2] ];
}

Expand Down