I am dealing with a calendar class that has a URL property which sometimes may be null. I want to prevent users from navigating if the URL is null (as it currently navigates to the root URL).
This is what I have:
<a href="{{calendar.url}}" target="_blank">{{ 'Home.calendar.readMore' | translate }} <i class="fa fa-angle-right"></i></a>
So, I decided to change the href to:
<a href="{{calendar.url == null ? 'javascript:void(0);' : calendar.url}}" target="_blank">{{ 'Home.calendar.readMore' | translate }} <i class="fa fa-angle-right"></i></a>
However, this now generates the following URL:
<a _ngcontent-evn-15="" target="_blank" ng-reflect-href="unsafe:javascript:void(0);" href="unsafe:javascript:void(0);">
Any suggestions on what I can do in this situation?