在组件中创建博客和文章加载器中的所有位置。我需要一次创建一个加载程序,并在整个应用程序中使用它。但是问题是,在ionic 3中,我们无法手动关闭加载程序。出现以下正确代码后,应将其关闭:
ionViewLoaded() {
let loader = this.loading.create({
content: 'Getting latest entries...',
});
loader.present().then(() => {
this.someService.getLatestEntries()
.subscribe(res => {
this.latestEntries = res;
});
loader.dismiss();
});
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用服务创建一次加载程序,并在需要整个应用程序时使用它。如:
import {Injectable} from '@angular/core';
import { LoadingController } from 'ionic-angular';
@Injectable()
export class BasicService{
loader: any;
constructor(public loadingCtrl: LoadingController){
//creates loader once so there is less data redundancy
this.loader = this.loadingCtrl.create({
content: `loading...`,
});
}
showLoader() { //call this fn to show loader
this.loader.present();
}
hideLoader() { //call this fn to hide …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用接口从API获取数据.贝娄是我的临时界面
export interface ITemp {
id: number,
name: string,
age: number
}
Run Code Online (Sandbox Code Playgroud)
下面是我的HTTP服务,其中有一个fn getHomedetails,它调用API.
import {Injectable} from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ITemp } from "../interfaces/temp";
import { Observable } from "rxjs/Observable";
import 'rxjs/Rx';
@Injectable()
export class HttpService{
http:any;
baseUrl: String;
constructor(http:HttpClient){
this.http = http;
this.baseUrl = 'some_url';
}
getHomeDetails(): Observable<ITemp> {
return this.http.get<ITemp>(this.baseUrl); //problem is here
//when mouse is pointed on get<ITemp> it shows "Untyped function calls may not accept type arguments"
}
}
Run Code Online (Sandbox Code Playgroud)
接口未定义.我不知道我做错了什么.上面的语法是一个有角度的4.3X语法.我使用的编辑器是崇高的视觉工作室.
javascript angularjs typescript angular4-httpclient angular5
当我尝试使用Ionic Storage在本地存储中设置正常值时.
它在高级手机上的离子安卓应用程序中运行良好(具有高性能).
但是在预算Android手机上,当手机有内存问题时,例如可用内存空间不足一GB.在本地存储中插入第一个值会抛出"QuotaExceededError".这使我的应用无法在该特定手机上使用其本地存储空间.
我该如何解决这个问题?