Я использую angular2 и машинопись.Угловой запрос 2-х запросов с доступом -Применение-Разрешить-Происхождение установлено на *
Я пытаюсь опубликовать в моем списке подписки на шимпанзе.
Мой код до сих пор:
constructor(router: Router, http: Http){
this.router = router;
this.http = http;
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json');
this.headers.append('Access-Control-Allow-Origin', '*');
}
subscribe =() => {
var url = "https://thepoolcover.us10.list-manage.com/subscribe/post?u=b0c935d6f51c1f7aaf1edd8ff&id=9d740459d3&subscribe=Subscribe&EMAIL=" + this.email;
this.isSuccess = false;
this.http.request(url, this.headers).subscribe(response => {
console.log(response);
this.isSuccess = true;
});
}
Это ошибка я получаю в моей консоли:
Я получаю эту ошибку прямо сейчас: неперехваченным SyntaxError: Неожиданный маркер <
Текущий код:
export class Footer{
email: string = "";
router : Router;
http : Http;
jsonp: Jsonp;
isSuccess: boolean = false;
constructor(router: Router, jsonp: Jsonp, http: Http){
this.router = router;
this.http = http;
this.jsonp = jsonp;
}
subscribe =() => {
var url = "https://thepoolcover.us10.list-manage.com/subscribe/post?u=b0c935d6f51c1f7aaf1edd8ff&id=9d740459d3&subscribe=Subscribe&EMAIL=" + this.email;
this.isSuccess = false;
this.jsonp.request(url).subscribe(response => {
console.log(response);
this.isSuccess = true;
});
}
я думаю, что эта проблема в свойствах сервера см: http://stackoverflow.com/questions/36825429/angular-2-no-access-control -allow-origin-header-is-present-on-the-request –
Пожалуйста, смотрите ниже ответ: [Контроль доступа Разрешить источник] (http://stackoverflow.com/a/42547842/6699781) –