Recently, I embarked on creating an app with Ionic from scratch and decided to integrate the framework.
While I faced no issues executing the example on a webpage, I encountered difficulties when attempting to do so with Ionic.
To kickstart the project, I used the following command:
ionic start form blank --v2 --ts
I then proceeded to link the necessary js files in the index.html:
<script type="text/javascript" src="build/js/libs/schema-form/angular.min.js"></script>
<script type="text/javascript" src="build/js/libs/schema-form/angular-sanitize.min.js"></script>
<script type="text/javascript" src="build/js/libs/schema-form/tv4.js"></script>
<script type="text/javascript" src="build/js/libs/schema-form/ObjectPath.js"></script>
<script type="text/javascript" src="build/js/libs/schema-form/schema-form.min.js"></script>
<script type="text/javascript" src="build/js/libs/schema-form/bootstrap-decorator.min.js"></script>
Following that, I made modifications to the home.html file as shown below:
<ion-content padding>
<div ng-controller="FormController">
<form sf-schema="schema" sf-form="form" sf-model="model"></form>
</div>
</ion-content>
Subsequently, I adjusted the home.ts file accordingly:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { FormPage } from 'schemaForm';
@Component({ templateUrl: 'build/pages/form/form.html', })
export class FormPage { constructor(private navCtrl: NavController) {
angular.module('myModule', ['schemaForm']).controller('FormController',
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 = {}; });
}
The main objective behind this endeavor was to incorporate the example form into an Ionic app. While I admire the simplicity of schema form, I am struggling to seamlessly integrate the form within an app framework. Any assistance or guidance would be greatly appreciated...