I'm currently working on an Angular 5 UI project. In one of my component templates, I have a text area where I'm attempting to set a value from the component.ts file using jQuery. However, for some reason, it's not working. Any suggestions on what might be causing this issue?
<textarea id="messageTxt" formControlName="message" rows="6" [placeholder]="'PLACEHOLDERS.MESSAGE' | translate" (keyup)="calculateMessagingSegmentCount(messageTxt.value)" #messageTxt></textarea>
In my component, I'm trying the following:
@Component({
selector: 'pc-sms-template-form',
templateUrl: './sms-template-form.component.html',
styleUrls: ['./sms-template-form.component.scss']
})
export class SmsTemplateFormComponent implements OnInit {
ngOnInit() {
$('#messageTxt').val("FEDEX@@@@@@ ");
}
}
Although I've correctly imported jQuery and there are no compilation errors, the textarea is still not displaying the value "FEDEX@@@@@@". Any insights into why this might be happening? I understand that using jQuery with TypeScript in an Angular component is not ideal, but due to certain requirements, I have to use jQuery.
Thank you.