Comments (8)
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.
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.
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.
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.
I've fixed it now :)
from ngx-schema-form.
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.
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.
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)
- Could not resolve dependency - peer @angular/common@"^11.2.6" from [email protected]
- Parent container for all the form actions HOT 3
- [Bug]: Type mismatch with sf-form component input HOT 1
- Regression loading array data with v 2.7.0
- Visible If not working if value is [0] HOT 3
- Add support for Angular 14 HOT 2
- when adding my angular 14.0.6 project > npm install ngx-schema-form --save HOT 4
- "visibleIf" with nothing vs. "oneOf"
- Support for draft 2020-12 array syntax
- are dependent fields in JSON schema supported ? HOT 2
- visibilityIf no longer works when target is multiple Select widget HOT 2
- Type 'string' is not assignable to type 'TSchemaPropertyType | undefined' HOT 1
- Add support for Angular 15 HOT 3
- Compatibility issue with Angular version 8.2 HOT 5
- Large number input fields behaving oddly HOT 2
- Compatibility with angular 16 HOT 3
- ESM imports not working HOT 1
- undefined type "undefined" error for a valid schema HOT 1
- Issue with visibleIf in array items HOT 4
- upgrade to Angular 17 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-schema-form.