Let’s start with an example. In an AngularJS application for users registration you collect information like Country, State Name, Family and Email Address. We want to model rules to enforce the behaviours below on the client side, with no server round-trip:
1. Filters States based on the Country
2. Validates the form on Submit
Let’s have a look at the application:
In this scenario, we used Decision Table to model the filtering behaviour:
Obviously, your rules can be as complex as you need them to be. You can have as many conditions (inputs) and actions (outputs) as you need.
In this scenario, we used Natural Language to model the validation behaviour:
Now your rules are all ready, let’s deploy them to your AngularJS web application.
Deployment can be achieved using the publish button. Select the target platform:
And then add all the logic you want to deploy to the JS platform:
After integrating the JS files for your rules, now when you select the Country then the States field is updated:
Also, when you try to submit the form, if you leave fields empty or in an invalid state (e.g., invalid email address) you get the error messages from JS BRE notifications:
To learn more please visit https://resource.flexrule.com/knowledge-base/js-test-bed/
Last updated November 6th, 2019 at 12:26 pm, Published May 15th, 2017 at 12:26 pm