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

Commit

Permalink
fix(chips): safety check before getting length
Browse files Browse the repository at this point in the history
If the model is not yet filled (ajax?) this functions fails with:

TypeError: Cannot read property 'length' of undefined

Ported the fix from: sime/ui-select@1edc16b

Closes #6175
  • Loading branch information
StefanFeederle authored and ThomasBurleson committed Apr 19, 2016
1 parent 7c6ff36 commit 4c47b27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/chips/js/chipsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ MdChipsCtrl.prototype.chipKeydown = function (event) {
*/
MdChipsCtrl.prototype.getPlaceholder = function() {
// Allow `secondary-placeholder` to be blank.
var useSecondary = (this.items.length &&
var useSecondary = (this.items && this.items.length &&
(this.secondaryPlaceholder == '' || this.secondaryPlaceholder));
return useSecondary ? this.secondaryPlaceholder : this.placeholder;
};
Expand Down

0 comments on commit 4c47b27

Please sign in to comment.