you can have dynamic field name. but you must create a directive with controller, that sets name attribute.
you can read more about it here: https://groups.google.com/forum/#!topic/angular/YFVb5d54dY0 On Thursday, August 2, 2012 12:27:19 AM UTC+2, Flavio Silva wrote: > > Hi, > > I'm working with angular in the last two weeks. It's pretty nice and I was > enabled to do even not so trivial things like creating a custom directive. > But I can't figure out how to have a input field with dynamic name fully > working. > I can see several (not trivial) scenarios where it is needed, such as some > kind of form generator, so I'm assuming no one will ask me why I need to do > it. > > I've spent several hours trying to do it, have read a lot of > angularjs.orgdocs but I'm missing something. Like I said I'm pretty new to > angular, but > I've a good understanding of the general concepts such as DI, MVC, etc. > I've tried to create a directive that somehow compile the dynamic name of > the input, but without success. I don't know if this is the way to do it. > > I've created a very simple jsfiddle with a basic two-field dynamic form > which exactly represents my scenario and what I expect to happens. > > http://jsfiddle.net/flsilva/8JzDb/8/ > > The expected result is that the fields should be validated, ie. "Can't be > empty." message should appear when the fields are empty. > I want to do it in the angular way, not an ungly hack. > If I can write a very simple directive like > "dynamic-name='my_dynamic_generated_string'" and somehow put it into the > name attribute it would be great. > Anyone know what's the better way to handle it? > Let me know if there's a better way to do it. > Any help is appreciated. > > > Thanks, > Flavio Silva > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
