Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
JohnA edited this page May 5, 2016 · 14 revisions

ngFormioHelper Docs

Note: Relative to your index.html, there must be a views/user/auth.html

Required files (relative to index.html):

  • views/user/auth.html
  • views/user/(any "name" instances of the .register method).html

FormioProvider

.setBaseUrl(url);

Name Type Description
url String The base url to your Form.io account

Example: https://(your unique Form.io project ID).form.io/

FormioAuthProvider

.setForceAuth(bool);

Name Type Description
bool Boolean Set to true if you would like the user to only have access to the login page until they are authenticated. Otherwise, set it to false.

Example: FormioAuthProvider.setForceAuth(true);

.setStates(anonState, authState);

Name Type Description
anonState String The login state. Defaults to "login.auth".
authState String The state the user is redirected to after login. Defaults to "home".

Example: FormioAuthProvider.setStates('auth.login', 'home');

.register(name, resource, path);

Name Type Description
name String The name of your login template.
    <br /><br /> <i>NOTE: Make sure to add an (name).html file to the `views/user/` directory.</i></td>
</tr>
<tr>
    <td>resource</td>
    <td>String</td>
    <td>The resource that the login form is tied to. Set to null if you are tying the form to more than one resource. For example, if you had "employees" and "managers" logging in on the same form, you would set it to null. The form itself will confirm which resource the user is associated with.</td>
</tr>
<tr>
    <td>path</td>
    <td>String</td>
    <td>The url that the form will display when visible.</i></td>
</tr>

Example: FormioAuthProvider.register('login', 'user', 'login');


Events

$scope.$on('rowView', function(event, submission){})

$scope.$on('submissionView', function(event, submission){})

$scope.$on('submissionEdit', function(event, submission){})

$scope.$on('submissionDelete', function(event, submission){})

Name Type Description
event String The event.
submission Object The result of the submission as a promise.

States

resource + 'Index'

This state contains the ng-formio-grid with all of the submissions. If you click the links inside the first column, it will take you to a tabbed template that will allow you to View/Edit/Delete that single submission.

Example: $state.go('exampleResourceIndex')

resource + '.view', resource + '.edit', resource + '.delete'

This state contains the submission that was clicked on and fired the rowView event. Now that access to the submission's id was given, the submission id must be passed in as a stateParam to the $state.go() method. The key in the stateParam method MUST be the name of the resource + "Id"

Example: #### $scope.$on('rowView', function(event, submission){ $state.go('exampleResource.view', {"exampleResourceId" : submission._id}) })

Example: #### $scope.$on('rowView', function(event, submission){ $state.go('exampleResource.edit', {"exampleResourceId" : submission._id}) })

Example: #### $scope.$on('rowView', function(event, submission){ $state.go('exampleResource.delete', {"exampleResourceId" : submission._id}) })

Clone this wiki locally