Comment out a page element

Sometimes you have an issue and you just want to ensure that other things are working while simplifying the situation.
During development, it would be useful to have the ability to comment out a given element on a page (and any descendants), allowing for defining a baseline for the page before adding back in a problematic component.

That is a great question Kirk. A trick that we use to achieve what you described is temporarily adding and if attribute with a value of false like this:

That should let you “turn off” any part of a component.

ah, of course! Thanks!

sometimes, the element you’re trying to comment out will complain if you try to add a ‘If false’ to the attribute list.
Like this example:

You’ll get an error like:

Error in: <somepath>:5:38 - error NG5002: Can't have multiple template bindings on one element. Use only one attribute prefixed with *
5 <ng-container *ngIf="!links.reading" *ngIf="false" ad-id="762023">

In that case, just add to the IF that already exists, like this to comment out that element:
if !links.reading && false

I believe that the error message you posted is caused when you add an if to an element that has a repeat on it. If you look at the HTML that is generated, you will see that “if” generates to “*ngIf” and “repeat” generates to “*ngFor…”. Angular only lets you have one or the other of these structural directives.