Angular.js Dynamic Form input types

前端 未结 1 1336
眼角桃花
眼角桃花 2021-01-20 21:14

I\'m trying to make an Angular.js app that creates dynamic form inputs from a JSON object.

So firstly, I have a JSON object (called fields):

[
  {\"f         


        
相关标签:
1条回答
  • Topic if changing type property if <input> element is hot topic.

    Actually, as AngularJS behaviour depends on was jQuery added (before or after angular.js).

    Here you can read some discussion about possibility to change type: change type of input field with jQuery

    Also there is pull request to AngularUI for adding new directive with support of dynamic type change: https://github.com/angular-ui/angular-ui/pull/371

    If you find suggested solution is not good enough (though as type is not changed after you render form) you can go with ng-switch way - just show corrent input for user.

    0 讨论(0)
提交回复
热议问题