mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
#163 Fixed with empty Observable value
This commit is contained in:
parent
7e6616d053
commit
0028f91fd4
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ng2-alfresco-core",
|
||||
"description": "Alfresco Angular 2 Components core",
|
||||
"version": "0.1.29",
|
||||
"version": "0.1.30",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"typings": "typings install",
|
||||
|
@ -43,7 +43,11 @@ export class AlfrescoTranslationLoader implements TranslateLoader {
|
||||
let observableBatch = [];
|
||||
this._componentList.forEach((component) => {
|
||||
observableBatch.push(this.http.get(`${component}/${self.prefix}/${lang}${self.suffix}`)
|
||||
.map((res: Response) => res.json()));
|
||||
.map((res: Response) => res.json())
|
||||
.catch( (err: any, source: Observable<any>, caught: Observable<any>) => {
|
||||
// Empty Observable just to go ahead
|
||||
return Observable.of('');
|
||||
}));
|
||||
});
|
||||
|
||||
return Observable.create(observer => {
|
||||
@ -51,10 +55,17 @@ export class AlfrescoTranslationLoader implements TranslateLoader {
|
||||
(translations: any[]) => {
|
||||
let multiLanguage: any = '';
|
||||
translations.forEach((translate) => {
|
||||
multiLanguage += JSON.stringify(translate);
|
||||
if(translate !== '') {
|
||||
multiLanguage += JSON.stringify(translate);
|
||||
}
|
||||
});
|
||||
observer.next(JSON.parse(multiLanguage.replace(/}{/g, ',')));
|
||||
if(multiLanguage !== '') {
|
||||
observer.next(JSON.parse(multiLanguage.replace(/}{/g, ',')));
|
||||
}
|
||||
observer.complete();
|
||||
},
|
||||
(err: any) => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user