Reputation: 9247
I have this link:
<a [routerLink]="[menu.url ||'/']" [queryParams]="{procesId: menu.refParameter3}">
What i want is to check if this menu.refParamter3
exists if exists then add it in queryParams
, if not leave empty. Any suggestion?
Upvotes: 1
Views: 823
Reputation: 3418
What I would do is put an *ngIf inside the tag that checks if menu.refParameter3 exists then display the necessary template
Something like this
<!-- if refParameter3 exists -->
<a *ngIf="menu.refParameter3" [routerLink]="[menu.url ||'/']" [queryParams]="{procesId: menu.refParameter3}">
<!-- if there is no refParameter3 -->
<a *ngIf="!menu.refParameter3" [routerLink]="[menu.url ||'/']">
Upvotes: 1
Reputation: 40
You should set your variable in the controller.
For example:
$scope.procesId;
if ($scope.menu.refParameter3) {
$scope.procesId = $scope.menu.refParameter3;
}
And when you pass this variable it will be either empty or containing the refParameter3 value.
Upvotes: 0