angular-dynamic-forms icon indicating copy to clipboard operation
angular-dynamic-forms copied to clipboard

Control markup

Open tsi opened this issue 11 years ago • 6 comments

Hi, Thanks for this, it is working very well so far. My problem is that I'm not sure if and how I can control the output markup to play well with my app, based on ionic. That means that instead of:

<label>
  First Name
  <input type="text" name="first" ng-model="formData['first']" class="ng-pristine ng-valid">
</label>

I would like to have

<label class="item item-input">
  <span class="input-label">First Name</span>
  <input type="text" placeholder="First Name" ... >
</label>

How would I approach this? Thanks

tsi avatar Nov 04 '14 09:11 tsi

Some of that can be done by simply using the appropriate keys in the JSON template to generate the desired attributes on the <input> tags, but wrapping the label text in a <span> is currently not supported. You could try including the <span> in the label key, but I think Angular will probably escape the < and >. However, it would probably be a good idea to implement a better templating mechanism that would support such things natively. I can't give a timetable at the moment, though.

Perhaps someone would be willing to put together a PR?

danhunsaker avatar Nov 04 '14 21:11 danhunsaker

Hey is this feature supported yet ? This project works awesome for me , but i would like to out put my input types something like this `

` Wrap them in

rahil471 avatar Dec 03 '14 06:12 rahil471

No. It isn't.

danhunsaker avatar Dec 03 '14 07:12 danhunsaker

Okay Thanks for the reply! Anyway I can include other element between two inputs ?

rahil471 avatar Dec 03 '14 07:12 rahil471

Any unrecognized type is converted to a <span>, and all other properties of that unknown field are converted to attributes (except label, which becomes the text content of the tag). So {"type":"span","class":"clearfix"} would insert <span class="clearfix"></span>. Other than that, no; such functionality is beyond the scope of this project.

danhunsaker avatar Dec 03 '14 07:12 danhunsaker

Okay cool Thanks !

rahil471 avatar Dec 03 '14 07:12 rahil471