我正在寻找文件操作,例如创建,读取和写入文本或登录文件,我进行了很多研究,但是我没有找到合适的例子来做。该链接给出了示例,但当我在打字稿文件中使用该示例时,出现类似[ts]的错误,例如类型'Window'上不存在属性'requestFileSystem'。
像这样的例子
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {
console.log('file system open: ' + fs.name);
fs.root.getFile("newPersistentFile.txt", { create: true, exclusive: false }, function (fileEntry) {
console.log("fileEntry is file?" + fileEntry.isFile.toString());
// fileEntry.name == 'someFile.txt'
// fileEntry.fullPath == '/someFile.txt'
writeFile(fileEntry, null);
}, onErrorCreateFile);
}, onErrorLoadFs);
function writeFile(fileEntry, dataObj) {
// Create a FileWriter object for our FileEntry (log.txt).
fileEntry.createWriter(function (fileWriter) {
fileWriter.onwriteend = function() {
console.log("Successful file write...");
readFile(fileEntry);
};
fileWriter.onerror = function (e) {
console.log("Failed file write: …Run Code Online (Sandbox Code Playgroud) 我是离子新手,对textarea有问题.这是我的代码:
<textarea [(ngModel)]="userData.aboutme" name="" id="" cols="30" rows="20"
value="{{ about_me}}" style="width:100%; padding: 10px; margin-top: 3px;" >
</textarea>
Run Code Online (Sandbox Code Playgroud)
问题是该值未显示在textarea内.它只显示我删除了[(ngModel)].我非常需要帮助,非常感谢
我的Apache Cordova(含离子3)有问题,此问题仅发生在iPhone X上。
应用启动时,它会显示默认的离子飞溅屏幕(如下所示,但已缩放):
几毫秒后,此“默认启动屏幕”将替换为正确的屏幕(我为应用程序设计的启动屏幕)。
这些是我的初始图像:
<splash src="resources/ios/splash/Default@2x~iphone.png" />
<splash src="resources/ios/splash/Default@2x~universal~anyany.png" />
<splash src="resources/ios/splash/Default-568h@2x~iphone.png" />
<splash src="resources/ios/splash/Default-667h.png" />
<splash src="resources/ios/splash/Default-736h.png" />
<splash src="resources/ios/splash/Default-Landscape@2x~ipad.png" />
<splash src="resources/ios/splash/Default-Landscape@~ipadpro.png" />
<splash src="resources/ios/splash/Default-Landscape-736h.png" />
<splash src="resources/ios/splash/Default-Landscape~ipad.png" />
<splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" />
<splash src="resources/ios/splash/Default-Portrait@~ipadpro.png" />
<splash src="resources/ios/splash/Default-Portrait~ipad.png" />
<splash src="resources/ios/splash/Default~iphone.png" />
Run Code Online (Sandbox Code Playgroud)
我还尝试了更改启动屏幕文件(也检查了默认的CDVLaunchScreen),但找不到该默认离子飞溅屏幕的任何引用,如何找到此“图像”或其他内容,或者找到解决方案?
谢谢
在组件中创建博客和文章加载器中的所有位置。我需要一次创建一个加载程序,并在整个应用程序中使用它。但是问题是,在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) 我正在使用离子技术开发混合应用程序。我想使用离子本机文件打开工具插件从设备内部或外部存储打开(doc,ppt,xlsx,pdf,jpg,png)文件,但我只能使用以下代码打开pdf文件。我使用application / pdf打开pdf,打开其他文件我应该在application / pdf处替换什么?请帮我。谢谢。
import { FileOpener } from '@ionic-native/file-opener';
constructor(private fileOpener: FileOpener) { }
...
this.fileOpener.open('path/to/file.pdf', 'application/pdf')
.then(() => console.log('File is opened'))
.catch(e => console.log('Error openening file', e));
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我有一个如文档中所述的ItemReorder:
<ion-list reorder="true">
<ion-item *ngFor="let item of items">{{ item }}</ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud)
它按预期工作,我可以ion-items通过指向reoder图标来拖动它(参见手绘圈):

我发现平板电脑上的潜在用户正在测试,许多用户最初看不到图标和/或尝试拖动ion-item而不指向图标.他们希望整体ion-item可以拖延:
我该如何实现呢?任何见解都表示赞赏!
我已经检查了两次文档,谷歌搜索并在离子论坛和Ionic v1的这个插件上找到了这个未解答的问题.我还在Github上扫描了代码但没有成功.
我正在使用Ionic FCM和Laravel FCm软件包将通知发送到应用程序。
令牌已存储在数据库中,通知也已在应用程序中接收。问题是当应用程序处于后台并且轻按了通知时,特定页面无法打开。
用于处理被窃听的通知的代码来自Ionic docs:
console.log('This will print in all cases');
this.fcm.onNotification().subscribe(data => {
console.log('this will will print when app in background', data);
if (data.wasTapped) {
console.log('This never gets printed', data);
console.log("Received in background");
this.nav.setRoot(CommunicationPage, { 'message_id': data.page_id });
} else {
console.log('Data: this will will print when app in background', data);
this.nav.push(CommunicationPage, { 'message_id': data.page_id });
console.log("Received in foreground");
};
});
Run Code Online (Sandbox Code Playgroud) android firebase ionic-framework firebase-cloud-messaging ionic3
我正在处理HTTP请求,该请求将POST请求发送到Canada Post API以查询运输报价:
getRates(weight: number, originPostal, destPostal) {
const options = {
headers: new HttpHeaders({
'Authorization': 'Basic ' + btoa(this.TEST_USERNAME + ':' + this.TEST_PASSWORD),
'Accept': 'application/vnd.cpc.ship.rate-v3+xml',
'Content-Type': 'application/vnd.cpc.ship.rate-v3+xml',
'Accept-language': 'en-CA',
}),
};
const body = `
<?xml version="1.0" encoding="utf-8"?>
<mailing-scenario xmlns="http://www.canadapost.ca/ws/ship/rate-v3">
<customer-number>${this.TEST_NUMBER}</customer-number>
<parcel-characteristics>
<weight>${weight}</weight>
</parcel-characteristics>
<origin-postal-code>${originPostal}</origin-postal-code>
<destination>
<domestic>
<postal-code>${destPostal}</postal-code>
</domestic>
</destination>
</mailing-scenario>
`;
return this.http.post<any>(this.TEST_URL, body, options)
}
Run Code Online (Sandbox Code Playgroud)
查询在Postman上工作正常,而不适用于Ionic项目(ionic serve和ionic run -l).我在网上搜索它是一个CORS问题Http失败响应(未知网址):0未知错误,我已将下面添加到ionic.config.json文件中
"proxies": [
{
"path": "/price",
"proxyUrl": "https://ct.soa-gw.canadapost.ca/rs/ship/price"
}
]
Run Code Online (Sandbox Code Playgroud)
API密钥,URL由加拿大邮政提供,可在 …
我们正在研究IONIC 3项目,该概念具有在单个应用程序中包含多个应用程序的概念,因此,该应用程序枢纽包含8-10个应用程序,包括银行,购物,旅行,出租车预订等。
我们刚刚开始该项目,已经有大约300多个组件,还有至少20多个自定义/第三方IONIC Native插件,我们面临以下问题。
我们已经做了,
IONIC是适合这种庞大应用的合适平台吗?
任何提示或指导方针都将帮助我们前进。
我正在研究Ionic电子商务应用程序并使用Laravel中的API.我已经在购物车中添加了产品,但是当我增加购物车中的产品数量时,产品的价格却在增加,但总价格没有更新,而且当从购物车中取出产品时,它也没有更新价格.
这是我的cart.html:
<ion-header>
<ion-navbar color="primary">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>
Your Cart
</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-list *ngFor="let itm of cartItems" class="myitem11">
<ion-item>
<ion-thumbnail item-start >
<img src="{{itm.image}}">
</ion-thumbnail>
<h2>{{itm.name}}</h2>
<p>Actual Price:
<span [ngStyle]="itm?.discountp === '0' ? {'text-decoration':'none'} : {'text-decoration':'line-through'}">
?{{itm.disprice * itm.count}}
</span>
</p>
<p>Discount: {{itm?.discountp}}%</p>
<ion-row class="item-count">
<ion-col class="qty">
<button (click)="decreaseProductCount(itm)" clear ion-button small color="dark" class="mewbtn11">
-
</button>
<button ion-button small clear color="dark" class="mewbtn11">
{{itm?.count}}
</button>
<button (click)="incrementProductCount(itm)" clear ion-button small color="dark" …Run Code Online (Sandbox Code Playgroud)