JS condition printing <div> HTML

Asked

Viewed 44 times

1

I am wanting to create a condition in JS that I get an object in a file .html as follows:

<a each="gabarito in $this.gabaritosCopy">    
    <script> if (gabarito.valor == 'N') { </script>
        <div class="col-xs-3">
            <span class="col-md-4">Copiar</span>
        </div>
    <script> } </script>
    ...
</a>

Only it doesn’t work, someone could help me ?

  • Could you put a condition example that is plausible with your problem? What are the variables and under what conditions you need to display HTML?

  • @Andersoncarloswoss improved the example in the question !

  • Are you using some framework that allows you to do gabarito in $this.gabaritosCopy?

  • @Andersoncarloswoss Angular !

  • So just use the directive NgIf

  • Ngif from angular 2 is not implemented @Andersoncarloswoss

  • It appears that this is the documentation for version 7.2.15

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.