【发布时间】:2016-07-23 17:41:08
【问题描述】:
我在这里遇到了一些问题,我混合使用了 Angular2 和 Nativescript 的原生 JS 来使用 HTTP,因为在此实现之前我遇到了 Angular2 HTTP 的问题,但是我对如何将 JSON 响应从对 monthList 变量的 http 请求,以便可以在任何地方读取它。请帮忙,谢谢。
这是我的代码:
public monthList = [];
constructor(location: Location, private page: Page, private router: Router, private testing: any) {
this.router = router;
this.testing = testing;
let http = require("http");
http.getJSON("link")
.then(function (r) {
// Argument (r) is JSON!
}, function (e) {
// Argument (e) is Error!
console.log(e);
});
}
【问题讨论】:
标签: javascript android angular nativescript angular2-nativescript