Material: Custom validation in md-autocomplete

Created on 5 Jan 2016  路  7Comments  路  Source: angular/material

We have some custom validation directives that we'd like to be able to use on md-autocomplete, but can't, because it doesn't use ng-model (and the wrapped <md-input-container> has its own ng-model).

minor reported

All 7 comments

Great feature for PR from community contributor.

@calebegg What item you want to access from the ngModelController? The selected item or just the search text?

For our use case, we want the search text. Though, I know other people want the selected item so they can mark it as invalid if there's no selected item.

For our use case we would like to access the selected item as @calebegg said just to ensure an item was selected from the list instead of validating against the presence of search text.

Okay, I just think about the search text too. We should provide both possibilities. But in first, what do you think about mirroring a ngModel, which can be accessed from the custom directives?

Mirroring the ngModel for use with custom directives would be fine

Great to see this is being discussed!

@DevVersion what does mirroring the ngModel mean? Would it support the standard <md-autocomplete name=someName ng-model=$ctrl.someProp approach (see #7910)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeoLozes picture LeoLozes  路  3Comments

sbondor picture sbondor  路  3Comments

bobber205 picture bobber205  路  3Comments

robertmesserle picture robertmesserle  路  3Comments

ghost picture ghost  路  3Comments