Directives

Form Reset

When you need to give users the ability to clear form data, use the bbFormResettable and bbResettable directives.

Usage

Attach the bb-form-resettable directive to your form:

<form name="client_form" id="client_form" class="bb-form" role="form" bb-form-resettable>

And then for each input that needs to be ‘resettable’, attach the bb-resettable directive:

<input type="text" name="firstname" ng-model="client.first_name" required class="form-control" bb-resettable />

This binds a resetForm() method to the parent controller in which the form resides. Calling this method clears the model value associated to each input registered with the bb-resettable directive.

If you want to clear the ‘submitted’ flag associated with the form, pass the following as an option when calling resetForm():

resetForm({clear_submitted: true})