Need to find the locale and pass the same to service(get) call :
Property 'indexOf' does not exist on type '() => string[]'
Heading
in angular4.
//Call Languages
getshortLanguages() {
return new Array('en', 'es', 'fr', 'it', 'pt', 'de', 'ru', 'tr', 'ko', 'ja', 'zh-cn', 'zh-hk');
}
getLocale() {
const locale = this.dbservice.getSessionContext().locale.toLowerCase();
var Languages = this.getshortLanguages;
if (!locale) return 'en';
var languageCode = locale.split('-')[0].toLowerCase();
if (this.getshortLanguages.indexof(languageCode)>-1 ) {
return languageCode;
}
else return 'en';
}
this.getshortLanguages().indexOf(languageCode)you are missing the open/close () which calls the methodgetshortLanguages(). Otherwise you are returning the method without calling it.