<script>
"use typescript";
</script>
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/es6-shim@0.35.3/es6-shim.js"></script>
<script src="https://unpkg.com/core-js@2.5.0/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.8.16/dist/zone.js"></script>
<script src="https://npmcdn.com/systemjs@0.19.40/dist/system.src.js"></script>
<script>
System.import('systemjs.config.js')
.then(function () { System.import('main') })
.catch(console.error.bind(console));
</script>
</head>
<body>
<my-app>Loading AppComponent content here</my-app>
</body>
</html>
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<json-schema-form [(ngModel)]="data" loadExternalAssets="true">
</json-schema-form>
`,
})
export class AppComponent {
data = {
"first_name": "Jane", "last_name": "Doe", "age": 25, "is_company": false,
"address": {
"street_1": "123 Main St.", "street_2": null,
"city": "Las Vegas", "state": "NV", "zip_code": "89123"
},
"phone_numbers": [
{ "number": "702-123-4567", "type": "cell" },
{ "number": "702-987-6543", "type": "work" }
], "notes": ""
};
}
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {
JsonSchemaFormModule, MaterialDesignFrameworkModule
} from 'angular2-json-schema-form';
@NgModule({
imports: [
BrowserModule,
MaterialDesignFrameworkModule,
JsonSchemaFormModule.forRoot(MaterialDesignFrameworkModule),
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {
}
platformBrowserDynamic().bootstrapModule(AppModule);
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"noImplicitAny": false,
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib":["es2015", "dom"]
}
}
/**
* PLUNKER VERSION
* (based on systemjs.config.js in angular.io)
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'ts',
typescriptOptions: {
tsconfig: true
},
meta: {
'typescript': {
"exports": "ts"
}
},
paths: {
// paths serve as alias
'npm:': 'https://unpkg.com/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
'main': 'app/main',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
// typescript for compilation in the browser
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js',
'angular2-json-schema-form': 'npm:angular2-json-schema-form/bundles/angular2-json-schema-form.umd.js',
'ajv': 'npm:ajv/dist/ajv.min.js',
'lodash': 'npm:lodash/lodash.min.js',
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './app/main.ts',
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);