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

Commit 31787c0

Browse files
mertdeg2ThomasBurleson
authored andcommitted
fix(chips): Disable editing for custom templates
Closes #7586
1 parent c3085ee commit 31787c0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/chips/js/chipsDirective.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,12 @@
246246
var userTemplate = attr['$mdUserTemplate'];
247247
attr['$mdUserTemplate'] = null;
248248

249+
var chipTemplate = getTemplateByQuery('md-chips>md-chip-template');
250+
249251
// Set the chip remove, chip contents and chip input templates. The link function will put
250252
// them on the scope for transclusion later.
251253
var chipRemoveTemplate = getTemplateByQuery('md-chips>*[md-chip-remove]') || templates.remove,
252-
chipContentsTemplate = getTemplateByQuery('md-chips>md-chip-template') || templates.default,
254+
chipContentsTemplate = chipTemplate || templates.default,
253255
chipInputTemplate = getTemplateByQuery('md-chips>md-autocomplete')
254256
|| getTemplateByQuery('md-chips>input')
255257
|| templates.input,
@@ -274,6 +276,11 @@
274276

275277
$mdTheming(element);
276278
var mdChipsCtrl = controllers[0];
279+
if(chipTemplate) {
280+
// Chip editing functionality assumes we are using the default chip template.
281+
mdChipsCtrl.enableChipEdit = false;
282+
}
283+
277284
mdChipsCtrl.chipContentsTemplate = chipContentsTemplate;
278285
mdChipsCtrl.chipRemoveTemplate = chipRemoveTemplate;
279286
mdChipsCtrl.chipInputTemplate = chipInputTemplate;

0 commit comments

Comments
 (0)