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.org docs 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.
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