This would be a change that would be made to the following file to allow for custom default components added to each new form.
https://github.com/formio/formio-app-formbuilder/blob/master/src/app/index.route.js
This would be a change that would be made to the following file to allow for custom default components added to each new form.
https://github.com/formio/formio-app-formbuilder/blob/master/src/app/index.route.js
| (function() { | |
| 'use strict'; | |
| angular | |
| .module('formioApp') | |
| .config(routeConfig); | |
| /** @ngInject */ | |
| function routeConfig( | |
| $stateProvider, | |
| $urlRouterProvider, | |
| $injector, | |
| AppConfig, | |
| FormioResourceProvider, | |
| FormioFormsProvider, | |
| FormioFormBuilderProvider, | |
| FormIndexController | |
| ) { | |
| $stateProvider | |
| .state('home', { | |
| url: '/', | |
| templateUrl: 'views/main.html', | |
| controller: FormIndexController | |
| }) | |
| .state('users', { | |
| abstract: true, | |
| url: '/users', | |
| templateUrl: 'views/users.html' | |
| }); | |
| // Register all of the resources. | |
| angular.forEach(AppConfig.resources, function(resource, name) { | |
| FormioResourceProvider.register(name, resource.form, $injector.get(resource.resource + 'Provider')); | |
| }); | |
| FormioFormsProvider.register('userform', AppConfig.appUrl, {}); | |
| FormioFormBuilderProvider.register('', AppConfig.appUrl, { | |
| controllers: { | |
| form: { | |
| create: ['$scope', function($scope) { | |
| // Default elements in the form. | |
| $scope.form.components = [ | |
| { | |
| type: 'textfield', | |
| input: true, | |
| inputType: 'text', | |
| key: 'firstName', | |
| label: 'First Name' | |
| }, | |
| { | |
| type: 'textfield', | |
| input: true, | |
| inputType: 'text', | |
| key: 'lastName', | |
| label: 'Last Name' | |
| }, | |
| { | |
| type: 'button', | |
| action: 'submit', | |
| theme: 'primary', | |
| label: 'Submit', | |
| key: 'submit' | |
| } | |
| ]; | |
| }] | |
| } | |
| } | |
| }); | |
| // Register the form routes. | |
| $urlRouterProvider.otherwise('/'); | |
| } | |
| })(); |