I have encountered an issue where the placeholder attribute is showing as undefined in a TypeScript .ts file.
Here is the code snippet I wrote:
HTML Code-
<label class="lab1">Closing date</label>
<input placeholder="M/d/yyyy" type="text" [(ngModel)]="_module.ClosingDate" ngControl="ClosingDate" #ClosingDate="ngForm">
<button type="submit" class="custombutton" (click)="Test1(ClosingDate)">Get Placeholder value</button>
TypeScript file code-
function Test1() {
var i;
for (i = 0; i < arguments.length; i++) {
alert(arguments[i].name); // Here I receive the correct ngcontrol name - "ClosingDate"
alert(arguments[i].placeholder); // I expect to get "M/d/yyyy" but instead receiving "undefined"
}
}
When I click the button, it calls the Test1() method with the argument "ClosingDate", which corresponds to my ngcontrol name. While I can correctly retrieve the ngcontrol name in the Test1(), I am unable to access the placeholder value and it returns "undefined".
The code works fine with HTML input control, but when using ngcontrol, it poses an issue. Any suggestions on how I can obtain the placeholder value would be appreciated.
Thank you,
Kapil Bhagwat