I think this should be fairly simple, but for the life of me I can't get it working.
I have an angular string (placeholder) that I would like to reference from a jQuery function that's fired on $document.ready(). Basically this is what I have:
placeholder: string;
ngOnInit() {
this.translateService.get(['']).subscribe(translations => {
this.placeholder = this.translateService.instant('placeholder');
console.log('PLACEHOLDER', this.placeholder); <<<<<<<<< has expected value
});
$(document).ready(function () {
console.log('READY', this.placeholder); <<<<<<<<< undefined
$('#dropDown').select2({
placeholder: this.placeholder,
data: [
...
]
});
});
}
How do I reference this.placeholder from within the jQuery function?