json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Empty Form #851

Closed itaimo closed 7 years ago

itaimo commented 7 years ago

Empty Form - please advise

I added Schema Form and filled the relevant data but couldn't see the content presented: Controller:

 vm.schema = {
        "type": "object",
        "title": "Comment",
        "properties": {
            "name": {
                "title": "Name",
                "type": "string"
            },
            "email": {
                "title": "Email",
                "type": "string",
                "pattern": "^\\S+@\\S+$",
                "description": "Email will be used for evil."
            },
            "comment": {
                "title": "Comment",
                "type": "string",
                "maxLength": 20,
                "validationMessage": "Don't be greedy!"
            }
        },
        "required": ["name", "email", "comment"]
    }
    vm.form = [
          "name",
          "email",
          {
              "key": "comment",
              "type": "textarea",
              "placeholder": "Make a comment"
          },
          {
              "type": "submit",
              "title": "OK"
          }
    ]

    vm.entity = {
        "name": "Leeroy Jenkins",
        "email": "leeroy@palsforlife.com",
        "comment": "At least i have chicken."
    }

HTML:

 <div class="modal-header">
     <h3 class="modal-title">Card Details</h3>
 </div>
 <div class="modal-body">
     <form sf-schema="vm.schema" sf-form="vm.form" sf-model="vm.entity"></form>
 </div>
 <div class="modal-footer">
     <!--<button class="btn btn-success" ng-click="vm.save()">Save</button>-->
     <button class="btn btn-warning" ng-click="$close()">Close</button>
 </div>

Result: https://ibb.co/bZHbMF

Anthropic commented 7 years ago

@itaimo the "result" link doesn't work for me, can you fix it?

Anthropic commented 7 years ago

Nevermind I fixed the link, but it just goes to an image which is impossible to debug, I assume you are missing the right scripts or something isn't loaded, but I don't debug code unless people make a plunker.

Please re-open if you can provide more information (plunker) to help us to help you :)