Custom widget to masking text



I need to create a masking custom widget. My use case is as follows.

The text in the textbox should be masked based on pattern specified. The initial use case is, if the number is "68966486" then the widget should render "****6486". I wanted it to extend it so that it could mask based on the regular expression to make it more generic.

In order to achieve it, I tried the following so far.

**1. Custom Filter: **
Created custom filter but when I tried to import the widget it throws errors. To me, it looks like Bonita widget does not support custom angularjs filters. Please let me know if my assumption is wrong and if there is any sample code that anyone could share, would be great.

2. Alter the value in Controller:
Tried to read the text from inside an expression and then alter the value. Code snippet below

** widget.json**
property name ="text", which is bound to a variable from UI.

      "label" : "Text",
      "name" : "text",
      "caption" : "some caption",
      "type" : "html",
      "defaultValue" : "Basic html <br/>to format the <b>value</b>.",

** controller.js**

function pbMaskText($scope, $log){

  // trying to read the value, but the below line always returns **undefined**. 
  var valueToMask = $;

  // this below line also has no impact. It never gets assigned.
  $ = "my masked value"


But when I check in chrome developer window, I could see there is value in $ (but in controller.js, when I try to access it it's coming as undefined).



Submitted by purem23_1391351 on Fri, 06/21/2019 - 11:42

Any pointers from anyone??

No answers yet.