下面的代码负责从url加载翻译,但是他们必须联系向我返回json的终结点,但是在这种情况下,翻译没有加载是什么原因?
TypeScript:
@Injectable({
providedIn: 'root'
})
export class TranslationService implements TranslateLoader {
constructor(private http: HttpClient, private globalService: GlobalService) {}
getTranslation(): Observable<any> {
const urlTocall = url
const authorizationData = 'Basic ' + btoa(user + ':' + pwd);
const headerOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
Authorization: authorizationData
})
};
return this.http.get(urlTocall, headerOptions ).pipe(map((res: any) => {
return res.data.map(item => {
return item.attributes.documento;
});
}));
}
}