我正在尝试使用angular js promise在ionic内部使用以下代码从我的wordpress站点获取json数据:
import { Injectable } from '@angular/core';
import {Headers, Http} from '@angular/http';
import 'rxjs/add/operator/map';
let apiUrl = 'http://example.com/wp-json/wp/v2/posts';
/*
Generated class for
嗨,我是Angular的新手,我一直在努力学习Angular 2,所以要温柔点:)。我一直在尝试使用WordPress作为我的数据应用程序接口使用WP插件。到目前为止,已经能够从WordPress上获得帖子。下面是我的数据服务代码。
import {Injectable} from "angular2/core";
import {Http, Response} from 'angular2/http';
import {Observable} from 'rxjs/Rx';
import {PostInterface} from './
我有一些外部应用程序为我的Angular 2应用程序提供config.json。我需要我的angular 2的入口点如下:
angular2Application.setConfig('../config.json'); // in browser console e.g.
(然后我可以在angular2应用程序的任何我的服务中使用这个json )
此外,我的应用程序应该能够通过调用一些方法将一些数据从服务发送到任何外部应用程序,例如:
var config = angular2Application.getConfig(); // in external other JS a