Skip to content Skip to sidebar Skip to footer

How To Pass Multiple Parameters To A Button Alert (angular V10)

(Typescript) import { Component, OnInit, OnDestroy } from '@angular/core'; export class newComponent implements OnInit, OnDestroy { showAlert = false; firstName = ''; const

Solution 1:

It seems that you forgot to set the firstName attribute in your buttonClicked method:

buttonClicked(dataElement: DataModel): void {
  this.firstName = dataElement.firstName;
  window.location.href = this.url + '?showAlert=true' + '&firstName=' + dataModel.firstName;
}

Without this change, firstName would always be equal to its default value, which is am empty string in your case. This is why you only see ' has made a selection' displayed in your alert.

Post a Comment for "How To Pass Multiple Parameters To A Button Alert (angular V10)"