profile.component.ts:
var $inputs = $('#changePasswordForm :input');
var values = {
oldpassword: String,
newpassword: String
};
$inputs.each(function() {
console.log(this);
values[this.name] = $(this).val();
});
console.log(values.oldpassword, this.currentUser.username);
profile.component.html:
<form id='changePasswordForm'>
<div class='form-group input-field'>
<label for=''>Old Password*</label>
<input type='password' [(ngModel)]='oldpassword' name='oldpassword' class='form-control'>
</div>
<div class='form-group input-field'>
<label for=''>New Password*</label>
<input type='password' [(ngModel)]='newpassword' name='newpassword' class='form-control'>
</div>
</form>
Error:
ERROR in src/app/components/profile/profile.component.ts(82,19): error TS2339: Property 'name' does not exist on type 'HTMLElement'.
What did i go wrong ??
HTMLInputElementinstead? - CertainPerformancethisinstead of thejQueryso it is looking for the HTML biding for that. Ideally you should not mixed up, Angular & Jquery. It's a bad practice. - Rohit.007