Giter VIP home page Giter VIP logo

Comments (8)

fbessou avatar fbessou commented on June 10, 2024

You can put your schema-form component in a *ngIf="schema !== null" and update the schema variable when the user clicks the "Generate" button.

from ngx-schema-form.

estradamarkie avatar estradamarkie commented on June 10, 2024

Sorry did you mean something like this, when the page loads it tries to generate the form but its giving an error because my JSON schema doesn't have the $schema property. Which I'm trying to add via textarea so I can see if this function will actually generate the form.

`


<schema-form [schema]="jsonSchemaForm" *ngIf="schema !== null">

`

in my generate function()
this.jsonSchemaForm = (<HTMLInputElement>document.getElementById('RequestDisplay')).value;

from ngx-schema-form.

fbessou avatar fbessou commented on June 10, 2024

With your example, changing *ngIf="schema !== null" by *ngIf="jsonSchemaForm !== null" should work if you initialize jsonSchemaForm to null in you component's constructor. If it is not working try moving the *ngIf to the surrounding <div> element.

from ngx-schema-form.

estradamarkie avatar estradamarkie commented on June 10, 2024

Thanks,

Though if I put <schema-form [schema]="compiledJson" ></schema-form> in my HTML it's giving me an error of some 'type undefined`

Error: Uncaught (in promise): Error: Error in ./InterfaceComponent class InterfaceComponent - inline template:22:19 caused by: Cannot read property 'type' of undefined TypeError: Cannot read property 'type' of undefined

it seems like its trying to find compiledJson JSON schema once the page has been load, I assigned compiledJson in a public compiledJson: any at the very top of my constructor, then using that in a function() which is being triggered by ngOninit.

but if I do something like

public compiledJson = { jsonSchema } this works fine but my JSON schema is coming form the API.

JSON:
{ "type":"object", "properties":{ "Name":{ "type":"string" }, "Number":{ "format":"int32", "type":"integer" }, "PointInTime":{ "format":"date-time", "type":"string" }, "Url":{ "type":"string" }, "Children":{ "type":"array", "items":{ "type":"object", "properties":{ "ChildName":{ "type":"string" }, "ChildNumber":{ "format":"int32", "type":"integer" }, "ChildPointInTime":{ "format":"date-time", "type":"string" }, "CustomData":{ "type":"object", "additionalProperties":{ "type":"array", "items":{ "type":"object" } } } } } }, "$schema":"http://json-schema.org/draft-04/hyper-schema#" }

from ngx-schema-form.

estradamarkie avatar estradamarkie commented on June 10, 2024

I've fixed it now :)

from ngx-schema-form.

estradamarkie avatar estradamarkie commented on June 10, 2024

Idk if I should create a new issue for this but its more a query than an issue,

Is there a way of using the object name like "Name": {} as the description? the JS object I get back is from Swagger UI so its limited to what I can really do.

from ngx-schema-form.

fbessou avatar fbessou commented on June 10, 2024

You can create your own widgets using the path property as description but adding a description to your properties in your schema should be a lot easier.

from ngx-schema-form.

estradamarkie avatar estradamarkie commented on June 10, 2024

It would be but that's really not my decision, it would be the back-end people and I've already ask they said no haha,

Can you show an example how to? as I'm no longer using the textbox to edit my JSON so its just passing a massive JSON string to your module instead.

from ngx-schema-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.