Form.io I can't get the abstract and index view from my ResourceProvider with Angularjs

188 views Asked by At

I'm trying to create an entire state with FormioResourceProvider but I can't have the custom abstract view that I create in my folder views/resource/resource.html, which I set as abstract template in my Resource Provider.

angular.module('demoApp').provider('FoodSafetyResource', function() {
return {
  $get: function() { return null; },
  templates: {
    abstract: 'views/resource/resource.html',
    view: 'views/resource/view.html',
    index: 'views/resource/index.html',
    create: 'views/resource/create.html'
  },
  controllers: {
    index: '',
    view: '',
    delete: '',
  }
};});

Also, I registered my Resource Provider with FormioResourceProvider.register

 // Register all of the resources.
angular.forEach(AppConfig.resources, function(resource, name) {
  FormioResourceProvider.register(name, resource.form, $injector.get(resource.resource + 'Provider'));
});

I can't see the abstract view for this $state.go('foodsafetyIndex()')

foodsafetyIndex() state that has to be with a title

<div class="panel panel-headline">
  <div class="panel-heading">
    <h2>{{ currentResource.name | capitalize }}</h2>
  </div>
<div class="panel-body">
  <div class="col">
    <ul class="nav nav-tabs">
      <li role="presentation" ng-class="{active:isActive(currentResource.name + '.view')}" ><a ui-sref="{{ baseName }}.view()">View</a></li>
      <li role="presentation" ng-class="{active:isActive(currentResource.name + '.edit')}"><a ui-sref="{{ baseName }}.edit()">Edit</a></li>
      <li role="presentation" ng-class="{active:isActive(currentResource.name + '.delete')}" ><a ui-sref="{{ baseName }}.delete()">Delete</a></li>
    </ul>
    <div ui-view></div>
  </div>
</div>

How can I get this template that I did in the index state?.

1

There are 1 answers

0
Travis Tidwell On BEST ANSWER

The abstract view does not get triggered for the index state on the FormioResourceProvider. This is only created for the view, edit, and delete states.

Essentially, the states that get registered look like this.

  • Index - The index state which contains the data grid.
  • Create - The page that creates the submission
  • Abstract - The wrapper page for a submission that contains the view, edit, delete pages.
    • View - The view page for the resource submission.
    • Edit - The edit page for the resource submission.
    • Delete - The delete page for the resource submission.