md-chips that include an autocomplete throw an exception when they are readonly.
Codepen example
http://codepen.io/ddimitrop/pen/OVNjbd
There is an exception in dev console
TypeError: Cannot read property 'registerSelectedItemWatcher' of undefined at MdChipsCtrl.configureAutocomplete (angular-material.js:11978) at angular-material.js:12242 at angular.js:16299 at completeOutstandingRequest (angular.js:4924) at angular.js:5312
in line
https://github.com/angular/material/blob/786b0ed3652b7460c2c802efa1aa79972bd96f5d/src/components/chips/js/chipsDirective.js#L255
there is no guarantee that the compiled chipInputTemplate will include an actual auto-complete just because it was in the source
I'm having this issue all of a sudden and I'm not exactly clear as to why. Is there a way to get around this for the time being?
+1
+1
anyone have a temporary workaround until this is fixed?
+1
+1 but I have a workaround for now..
- ditch the readonly property for md-chips
- use your readonly var for the autocomplete's ng-disabled
- use a custom md-chip template
- add an ng-hide to the md-chip-remove button with your readonly var
+1
+1
@rafidka Are you still seeing this in 0.11? We pushed a fix in https://github.com/angular/material/commit/3e8c99455832a3e457a1de00afd1601c11d55c5e.
@topherfangio I think I am still on 0.10, I will try the new one and let you know.
@topherfangio sorry for the late response. I tried Angular 0.11 and it indeed solved it. Thanks!.
For those that end up here searching only...
TypeError: Cannot read property 'some' of undefined at MdChipsCtrl.appendChip
This is caused by an undefined in ng-model