Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74158

How to add ng-messages to a dynamically created input in AngularJS with Material

$
0
0

I have the following code that works except for the part where I try to add the ng-messages (they don't display). From my understanding, the ng-messages attaches to the name element. What am I doing wrong here?

<form ng-submit="submit(form)" name="form">
   <div ng-repeat="question in questions">
      <div ng-switch="question.type">
         <div ng-switch-when="text">
            <md-input-container class="md-block">
               <label>{{question.title}}</label>
               <input md-maxlength={{question.maxLength}}
                      required md-no-asterisk
                      name="questionStorage[question.id]"
                      ng-model="questionStorage[question.id]">
               <div ng-messages="form[questionStorage[question.id]].$error">
                   <div ng-message="required">This is required.</div>
...

Viewing all articles
Browse latest Browse all 74158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>