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

fix(chips): hide remove button on custom template when readonly #4090

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
6 changes: 5 additions & 1 deletion src/components/chips/demoBasicUsage/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.custom-chips {
.md-chip {
position: relative;
padding-right: 35px;
.md-chip-remove-container {
position: absolute;
right: 4px;
Expand Down Expand Up @@ -35,5 +34,10 @@
}
}
}
&:not(.md-readonly) {
md-chip-template {
padding-right: 20px;
}
}
}
}
7 changes: 4 additions & 3 deletions src/components/chips/js/chipsDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@
class="md-chips">\
<md-chip ng-repeat="$chip in $mdChipsCtrl.items"\
index="{{$index}}"\
ng-class="{\'md-focused\': $mdChipsCtrl.selectedChip == $index}">\
ng-class="{\'md-focused\': $mdChipsCtrl.selectedChip == $index, \'md-readonly\': $mdChipsCtrl.readonly}">\
<div class="md-chip-content"\
tabindex="-1"\
aria-hidden="true"\
ng-focus="!$mdChipsCtrl.readonly && $mdChipsCtrl.selectChip($index)"\
md-chip-transclude="$mdChipsCtrl.chipContentsTemplate"></div>\
<div class="md-chip-remove-container"\
md-chip-transclude="$mdChipsCtrl.chipRemoveTemplate"></div>\
<div ng-if="!$mdChipsCtrl.readonly"\
class="md-chip-remove-container"\
md-chip-transclude="$mdChipsCtrl.chipRemoveTemplate"></div>\
</md-chip>\
<div ng-if="!$mdChipsCtrl.readonly && $mdChipsCtrl.ngModelCtrl"\
class="md-chip-input-container"\
Expand Down