我有问题从apis的http请求中获取任何工作人员,当我查看源代码时,它看起来像不从服务器来的工作人员。服务器端不呈现http请求[Angular Universal]
所以我可以看到源代码,但来自HTTP请求没有静态html ....
任何人都知道可能是一个问题?
我使用universal-cli
编辑:
这里是例如HTTP调用从我的showcode.service.ts
:
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { environment } from '../../environments/environment';
@Injectable()
export class ShowcodeService {
constructor(private http: Http) { }
getCode(id): any{
return this.http.get(environment.baseUrl + 'code/show/' + id)
.map((response: Response) => response.json());
};
}
这里是活生生的例子:HTML的http://pushsc.com/show/code/58bc83760a58d602a0b99d14检查源代码.. 。它提供预期的东西来自http ...
发布您的模板和打字稿请 – KnowHoper
您需要什么部分?我使用了'universal-cli'创建的项目,就像这样'ung new project' – Vladimir
打字稿 - http调用。 – KnowHoper