I'm not entirely sure what you are trying to do, but does this help with what you are trying to achieve?
getOptions(country: Country) {
let index = this.cities.findIndex(c => c.country === country);
return this.cities.slice(0,this.cities.length - index);
}
constructor() {
this.countries = [
{ name: 'USA' },
{ name: 'Italy' },
{ name: 'UK' },
{ name: 'Turkey' },
{ name: 'France' }
];
this.cities = [
{ name: 'New York', code: 'NY', country: this.countries[0] },
{ name: 'Rome', code: 'RM', country: this.countries[1] },
{ name: 'London', code: 'LDN', country: this.countries[2] },
{ name: 'Istanbul', code: 'IST', country: this.countries[3] },
{ name: 'Paris', code: 'PRS', country: this.countries[4] }
];
}
<p-dropdown [options]="getOptions(country)" [ngModel]="dataBind.get(country)" optionLabel="name"
(onFocus)="createCityOptions()" editable="true" optionLabel="name"></p-dropdown>
If it does not and you can describe your intent some more, I will gladly update the answer.
You might also want to check this StackBlitz.