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

Commit

Permalink
fix(chips): Disable editing for custom templates
Browse files Browse the repository at this point in the history
Closes #7586
  • Loading branch information
mertdeg2 authored and ThomasBurleson committed Mar 16, 2016
1 parent c3085ee commit 31787c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/chips/js/chipsDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,12 @@
var userTemplate = attr['$mdUserTemplate'];
attr['$mdUserTemplate'] = null;

var chipTemplate = getTemplateByQuery('md-chips>md-chip-template');

// Set the chip remove, chip contents and chip input templates. The link function will put
// them on the scope for transclusion later.
var chipRemoveTemplate = getTemplateByQuery('md-chips>*[md-chip-remove]') || templates.remove,
chipContentsTemplate = getTemplateByQuery('md-chips>md-chip-template') || templates.default,
chipContentsTemplate = chipTemplate || templates.default,
chipInputTemplate = getTemplateByQuery('md-chips>md-autocomplete')
|| getTemplateByQuery('md-chips>input')
|| templates.input,
Expand All @@ -274,6 +276,11 @@

$mdTheming(element);
var mdChipsCtrl = controllers[0];
if(chipTemplate) {
// Chip editing functionality assumes we are using the default chip template.
mdChipsCtrl.enableChipEdit = false;
}

mdChipsCtrl.chipContentsTemplate = chipContentsTemplate;
mdChipsCtrl.chipRemoveTemplate = chipRemoveTemplate;
mdChipsCtrl.chipInputTemplate = chipInputTemplate;
Expand Down

0 comments on commit 31787c0

Please sign in to comment.