我正在使用Angular 4和一个API创建一个简单的应用程序,它有多个页面用于他们的请求.
例如,我使用此URL获取10个第一个字符:
http://swapi.co/api/people/
为了得到接下来的10个人,我必须向这个网址发出请求: http://swapi.co/api/people/?page=2
如何在一个请求中获得所有人?或者通过良好实践制定所有请求的解决方案是什么?
我正在尝试在一个简单的Google地图上获得几个标记。我正在使用使用Angular 4的Ionic 3。
我正在这样加载地图:
import { Component, ViewChild, ElementRef } from '@angular/core';
import { GoogleMaps } from '@ionic-native/google-maps';
declare var google;
export class SearchResultsPage extends BasePage {
@ViewChild('map') mapElement: ElementRef;
private map: any;
constructor(public navCtrl: NavController,
public navParams: NavParams,
private translateService: TranslateService,
private googleMaps: GoogleMaps) {}
ionViewDidLoad() {
setTimeout(()=>{
this.loadMap();
}, 1000)
}
loadMap() {
let latLng = new google.maps.LatLng(48.8509695, 2.3861870000000636);
let latLng2 = new google.maps.LatLng(48.8504541, 2.3865487000000485);
let mapOptions = {
center: latLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = …Run Code Online (Sandbox Code Playgroud)