Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am working on schema form angular js mvc application,want to generate a form or template using json schema but its not working in my application , i have inject a "Schema-Form" in my controller and form tag with schema but its does not work ,also include js file for schema forms....some time its working proper but after project second build its does not show anything......
this is the output i am getting in html generated

<bootstrap-decorator form="schemaForm.form[0]" class="ng-scope"><bootstrap-decorator form="schemaForm.form[1]" class="ng-scope"><bootstrap-decorator form="schemaForm.form[2]" class="ng-scope">

getting this html generated tags with form and bootstrap-decorator but "field set is not generated"
in schema form tag

What I have tried:

<script src="~/Contents/js/external/angular-sanitize.min.js"></script>
<script src="~/Contents/js/external/tv4.js"></script>
<script src="~/Contents/js/external/ObjectPath.js"></script>
<script src="~/Contents/js/external/schema-form.js"></script>
<script src="~/Contents/js/external/bootstrap-decorator.js"></script>

i have inculde these files on master form also inject a "Schema-form" in controller
after that inculde a form tag in cshtml page


@{
Layout = null;
}



<div ng-app="EMRProtocolListModule" ng-controller="EMRProtocolListController">
<form sf-schema="schema" sf-form="form" sf-model="model"></form>
</div>


after that write a sample controller code for bind schema form



'use strict';

angular.module('EMRProtocolListModule', ['ngSanitize', 'schemaForm'])
.controller('EMRProtocolListController', function ($scope) {
$scope.schema = {
type: "object",
properties: {
name: { type: "string", minLength: 2, title: "Name", description: "Name or alias" },
title: {
type: "string",
enum: ['dr', 'jr', 'sir', 'mrs', 'mr', 'NaN', 'dj']
}
}
};

$scope.form = [
"*",
{
type: "submit",
title: "Save"
}
];

$scope.model = {};
});
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900