How do I hide a HTML Button based on a field ?

F_bio Santos
Kilo Sage

Hi everyone, I have a Button (Widget) that should be available for every record producer but 1, I tried to put a condition on the HTML based on a field that is in the Record Producer that this button shouldnt appear in.

This is what I tried:

<div id="ResolveButton" class="panel panel-default" ngIf="data.state == '2' && data.aprovado_reprovado == '123'">
    <div class="panel-heading">${Resolve}</div>
    <div class="panel-body">
        <button type="button" class="btn btn-primary btn-block" style="background-color: #3641B3;" ng-show="data.state == '2'" ng-click="c.uiAction('resolve')">${Resolver}</button>
    </div>
</div>


Im trying to use the: 

&& data.aprovado_reprovado == '123'

Which is a field that is in the Record Producer that the button is not supost to appear, but it keeps appearing ...

1 ACCEPTED SOLUTION

Hi Niklas, the ngIf also works, I ended up doing it with other solution.

I used:

Server Script: 

    data.table = $sp.getParameter("table");

    gr = new GlideRecord(data.table);
    if (!gr.isValid())
        return;

data.unid = gr.getValue('sys_class_name');


HTML:

ng-show="data.unid != '(sys_class_name_needed)'"

 

View solution in original post

2 REPLIES 2

Niklas Peterson
Mega Sage
Mega Sage

Hi,

Your condition says ngIf... should it not be ng-if?

 

And how do you assign the value of data.aprovado_reprovado ?

 

Regards,
Niklas

Hi Niklas, the ngIf also works, I ended up doing it with other solution.

I used:

Server Script: 

    data.table = $sp.getParameter("table");

    gr = new GlideRecord(data.table);
    if (!gr.isValid())
        return;

data.unid = gr.getValue('sys_class_name');


HTML:

ng-show="data.unid != '(sys_class_name_needed)'"