【发布时间】:2017-08-02 04:51:10
【问题描述】:
当我执行“查看源代码”时,我无法从 api 的 http 请求中获取任何人员,看起来该人员不是来自服务器。
所以我可以在源代码中看到静态 html,但从 http 请求中看不到任何内容......
有人知道可能是什么问题吗?
我正在使用universal-cli
编辑:
这是来自我的showcode.service.ts 的 http 调用示例:
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());
};
}
这里是一个活生生的例子:http://pushsc.com/show/code/58bc83760a58d602a0b99d14 检查 html 的源代码...它渲染了来自 http 的期望的东西...
【问题讨论】:
-
请发布您的模板和打字稿
-
您需要什么零件?我使用
universal-cli创建了这样的项目ung new project -
http 调用的打字稿。
-
我更新了我的主要问题...从我的服务添加了 http 调用...
-
@Vladimir 你还有这个问题吗?
标签: angular angular-universal universal-cli