这是我的promise函数,我需要返回rs.rows.item(0)的值;
public getCustomer() : any
{
let db = window.sqlitePlugin.openDatabase({name: 'data.db', location: 'default'});
return new Promise((resolve, reject) =>
{
db.transaction(function(tx)
{
tx.executeSql('SELECT * FROM customer ORDER BY customerId DESC LIMIT 1', [], function(tx, rs)
{
return resolve(rs.rows.item(0));
},
function(tx, error)
{
console.log('SELECT error: ' + error.message);
reject(error);
});
});
});
}
Run Code Online (Sandbox Code Playgroud)
我需要得到这样的例子
var customer = getCustomer();
customer.name;
customer.email;
Run Code Online (Sandbox Code Playgroud) git仓库中有一个包
https://github.com/keephacking/ionic-scrolling-header
有一切使它兼容aot.但在使用时构建我的应用程序
ionic build --prod 命令,aot build失败,错误如下所示.
[18:02:48] ngc started ...
[18:02:57] typescript error
Unexpected value 'ScrollingHeaderModule in
xxx/node_modules/ionic-scrolling-header/scrolling-header.module.d.ts' imported by the
module 'xxxModule in xxx/xxx.module.ts'. Please add a @NgModule
annotation.
Error: The Angular AoT build failed. See the issues above
at xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:237:55
at step (xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
at Object.next (xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
at fulfilled (xxx\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
[18:02:57] copy finished in 10.69 s
Run Code Online (Sandbox Code Playgroud)
我在Package.json中的依赖项
{
"dependencies": {
"@angular/common": "5.2.0",
"@angular/compiler": "5.2.0",
"@angular/compiler-cli": "5.2.0",
"@angular/core": "5.2.0",
"@angular/forms": "5.2.0",
"@angular/http": "5.2.0",
"@angular/platform-browser": "5.2.0",
"@angular/platform-browser-dynamic": "5.2.0",
"@ionic-native/core": …Run Code Online (Sandbox Code Playgroud) 我在iOS 11.3.1和iOS模拟器上使用iPhone 6在移动Safari上遇到了一个奇怪的错误.
我有一个Ionic应用程序(PWA,而不是Cordova),使用Laravel(PHP)构建的后端API已经好几个月了.我已经配置了CORS,它工作正常.
我刚刚尝试实现一个新功能,我上传了一个图像,它只在移动Safari上中断.
我看到OPTIONS请求通过,看起来是正确的.事实上,请求/响应看起来完全相同,除了User-Agent桌面Safari工作.
在桌面Safari上,随后是POST成功的.
在移动Safari浏览器POST甚至不尝试走出去,相反,我得到一个消息Failed to load resource: Origin https://upload.geekity.com is not allowed by Access-Control-Allow-Origin.,尽管OPTIONS恢复要求https://upload.geekity.com的Access-Control-Allow-Origin.
这里有两个网页检查的截图OPTIONS,并POST在台式机和移动Safari浏览器.

你可以在这里查看源代码:image-upload.
我真的不知道这里会发生什么,以这种方式失败.
我在Angular 5.2上有一个Ionic 3应用程序.我正在尝试更新到角度6.我按照升级指南已经为HttpClient和NgModule.我现在遇到的问题是ionic-native.
我安装了ionic-native使用rxjsv6的V5 (angular6要求并且与以前的版本不兼容).
这是我的app.module.ts档案
import { Device } from '@ionic-native/device/ngx';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'
import { BrowserModule } from '@angular/platform-browser'
import { HttpClientModule } from '@angular/common/http'
@NgModule({
declarations: [
MyApp,
],
imports: [
BrowserModule,
HttpClientModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot(),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp
],
providers: [
Device
]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
我收到了多个错误
找不到名字'设备'
'{declarations:(typeof MyApp)[];类型的参数; import :( ModuleWithProviders | …
我正在使用PDFMake来创建具有预定义文档定义的pdf.在我的旧离子1项目中,我将编码的字符串传递给print函数,该函数工作正常.这是旧离子1的代码
var dd = $scope.createDocumentDefinition();
$timeout(function () {
var pdf = pdfMake.createPdf(dd);
pdf.getBase64(function (encodedString) {
console.log(encodedString);
$ionicLoading.hide();
window.plugins.PrintPDF.print({
data: encodedString,
type: 'Data',
title: 'Print Document',
success: function () {
console.log('success');
},
error: function (data) {
data = JSON.parse(data);
console.log('failed: ' + data.error);
}
});
});
}, 1000);
Run Code Online (Sandbox Code Playgroud)
现在我正在将我的项目升级到Ionic 3,所以我尝试了相同的东西,但输出不同,这是我的新离子3代码.打印机打开但不是根据我的文档定义打印它只打印编码的字符串.
let printer_ = this.printer;
var dd = this.createDocumentDefinition();
var pdf = pdfMake.createPdf(dd);
pdf.getBase64(function (_encodedString) {
let options: PrintOptions = {
name: 'MyDocument'
};
console.log(JSON.stringify(pdf));
printer_.print(_encodedString, options).then((msg)=>{
console.log("Success",msg);
},(error) => {
console.log("Error", …Run Code Online (Sandbox Code Playgroud) 我刚刚更新到Mac Mojave(我确定这是我的问题的原因).
问题是每次我尝试使用命令构建我的应用程序.
ionic cordova build ios
Run Code Online (Sandbox Code Playgroud)
我收到以下错误.
CordovaError: Promise rejected with non-error: 'ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
Run Code Online (Sandbox Code Playgroud)
enter code here[错误]运行子进程cordova时发生错误.
cordova build ios exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Run Code Online (Sandbox Code Playgroud)
我想我需要安装ios-deploy所以我运行了这个命令.
npm install -g ios-deploy
Run Code Online (Sandbox Code Playgroud)
但我得到以下错误.
npm ERR! code ELIFECYCLE
npm ERR! …Run Code Online (Sandbox Code Playgroud) 我正在将paytm集成到angular 4中。paytm插件已成功添加到project中,但是我不知道如何在ts文件中导入paytm插件。并调用java文件文件功能。
请帮助我...这是我的代码
import { Nav, Platform } from 'ionic-angular';
import { Component, OnInit } from '@angular/core';
import { NavController } from 'ionic-angular';
import {} from 'jasmine';
import {LoginPage} from "../login/login";
import {SignUpPage} from "../signup/signup";
import {HomePage} from "../home/home";
import { Paytm } from '@ionic-paytm/paytm';
@Component({
selector: 'page-apphome',
templateUrl: 'apphome.html'
})
export class AppHomePage implements OnInit {
constructor(public navCtrl: NavController ,public paytm:Paytm) {}
ngOnInit(){
window.plugins.paytm.startPayment("526", "25862", "abc@gmail.com",
"777777777", "25", successCallback, failureCallback);
var userids=window.localStorage.getItem('userid');
//alert(userids);
if(userids!= null)
{
this.navCtrl.push(HomePage);
}
} …Run Code Online (Sandbox Code Playgroud) 上次我成功构建但在添加了我无法构建的页面数量之后,我确实搜索了很多错误,但没有任何对我有用.例如,添加和删除平台,离子cordova清洁,离子cordova构建等...
以下错误面临运行 - 离子cordova构建android
出了什么问题:任务执行失败' :app:transformDexArchiveWithExternalLibsDexMergerForD ebug'. java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.de xing.DexArchiveMergerException:无法合并dex
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.
在https://help.gradle.org获取更多帮助
在7s建立失败
IOnic信息:
cli包:(C:\ Users\ITSERV\AppData\Roaming \npm \node_modules)
@ ionic/cli-utils:1.19.2 ionic(Ionic CLI):3.20.0全局包:
cordova(Cordova CLI):8.0.0本地包:
@ ionic/app-scripts:3.1.8 Cordova平台:android 7.0.0 Ionic Framework:ionic-angular 3.9.2系统:
节点:v6.11.2 npm:3.10.10操作系统:Windows 7
提前致谢!
它运行在小米Mix 2手机(Android版本8.0.0)和浏览器上没有任何问题.但是当我部署到三星note 2(android版本4.4.2)时,它给出了一条应用程序错误: net :: ERR_CONNECTION_REFUSED(http:// localhost:8080)
为什么我收到此错误?
任何建议和意见将不胜感激.
凯末尔.
无法解析配置“ classpath”的所有文件。
找不到com.google.android.gms:strict-version-matcher-plugin:1.1.0。
Searched in the following locations: https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar file:/C:/Users/e1706396/.m2/repository/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom file:/C:/Users/e1706396/.m2/repository/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar Required by: unspecified:unspecified:unspecified > com.google.gms:google-services:4.2.0
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
在https://help.gradle.org上获得更多帮助
7s cmd中的BUILD FAILED:命令失败,退出代码为1
我正在使用插件
<plugin name="cordova-plugin-appavailability" spec="^0.4.2" />
<plugin name="cordova-plugin-camera" spec="^4.0.3" />
<plugin name="cordova-plugin-compat" spec="^1.2.0" />
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-googleplus" spec="^5.2.1">
<variable name="REVERSED_CLIENT_ID" value="xxx" />
</plugin>
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.19" />
<plugin name="cordova-plugin-mfp" spec="^8.0.2018070216" …Run Code Online (Sandbox Code Playgroud)