Prasad Kanaparthi
Prasad Kanaparthi

Reputation: 6563

ng-messages dynamic form name

The below snippet is in directive. I'm calling directive from controller. passing formname="'AddressForm'" from controller.

<div ng-messages="formname.Zip.$error"
     ng-show="(!formname.Zip.$pristine || formname.$submitted)">
</div>

I've tried ng-messages="{{formname}}.Zip.$error" and got below error

Token '{' invalid key at column 2 of the expression [{{formname}}.Zip.$error] starting at [{::formname}}.Zip.$error].

How can i get formname ?

Upvotes: 0

Views: 12

Answers (0)

Related Questions