我正在尝试创建一个JS启动项目,但ionic start xxx --v2创建了一个打字稿项目.
我需要创建一个JS启动项目,这样我就可以将现有的JS ionic 2应用程序复制到干净的安装中.
我尝试将我的所有JS文件重命名为typescript,但是获得了大量类型的错误消息:
类型yyy上不存在属性xxx
最近的版本是3.2.0,我面临很多问题,比如
ionic serve命令不起作用.
$ ionic cordova plugin add cordova-plugin-http
$ npm install --save @ionic-native/http
Run Code Online (Sandbox Code Playgroud)
实施是:
constructor(private https: HTTP ) {
}
this.https.get('http://ionic.io', {}, {})
.then(data => {
this.httpData =data;
console.log(data.status);
})
.catch(error => {
console.log(error.status);
});
Run Code Online (Sandbox Code Playgroud)
我收到这个错误:
[20:49:03] console.warn:Native:尝试调用HTTP.get,但是没有安装HTTP插件.[20:49:03] console.warn:安装HTTP插件:'ionic plugin add cordova-plugin-http'
如何删除Cloud Firestore中的文档字段?...我正在使用下面的代码,但我不能.
this.db.doc(`ProfileUser/${userId}/followersCount/FollowersCount`).update({
[currentUserId]: firebase.firestore.FieldValue.delete()})
Run Code Online (Sandbox Code Playgroud)
谁知道怎么做?
嗨,几天以来我试图解决这个问题但没有成功.当我尝试使用管道翻译时,我得到了这个错误
Error: Uncaught (in promise): Error: Template parse errors:
The pipe 'translate' could not be found ("
<ion-content padding>
<h2>{{[ERROR ->]"HELLO" | translate }}</h2>
</ion-content>
"): ng:///AdminPannelPageModule/AdminPannelPage.html@11:8
Run Code Online (Sandbox Code Playgroud)
我正在使用角5.
这些是我用于翻译的版本
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
Run Code Online (Sandbox Code Playgroud)
Npm安装
npm install @ngx-translate/core @ngx-translate/http-loader --save
Run Code Online (Sandbox Code Playgroud)
这是我的Home.html页面
<h2>{{"HELLO" | translate }}</h2>
Run Code Online (Sandbox Code Playgroud)
用于翻译的JSON文件:
assets/i18n/en.json
{
"HELLO": "hello"
}
assets/i18n/it.json
{
"HELLO": "ciao"
}
Run Code Online (Sandbox Code Playgroud)
在导出我使用export function setTranslateLoader (http: HttpClient)而不是使用export function setTranslateLoader (http: Http)因为如果不是它给了我这个错误:Argument of type 'Http' is not assignable to parameter of type 'HttpClient …
我有一个场景,我使用离子将我的本地驱动器(键入jpeg或png)上的图像文件上传到API端点.这是我的代码如下:
fileupload.html - >
//---------------------------------------------------
<ion-item>
<ion-input type="file" accept="image/*" (change)="changeListener($event)"> </ion-input>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
fileupload.ts - >
changeListener($event):void{
this.file=$event.target.files[0];
console.log(this.file);
console.log("upload...");
let regData={"file":this.file};
console.log("REGDATAA"+JSON.stringify(regData));
this.jira.postAttachment("PM-3",regData).subscribe(dataa=>{
console.log(dataa);
});
}
Run Code Online (Sandbox Code Playgroud)
provider.ts - >
public postAttachment(key,data):Observable<any>{
console.log(JSON.stringify(data))
return this.http.post(this.api+'/issue/'+key+'/attachments',JSON.stringify(data),{
headers: new HttpHeaders()
.append('Authorization', `Basic ${this.auth.getAuthString()}`)
.append('Content-Type','multipart/form-data';boundary="-------xe3rtyhrfds")
.append("X-Atlassian-Token", "no-check")
.append("User-Agent", "xx")
});
}
Run Code Online (Sandbox Code Playgroud)
每次我发送文件时它都没有采用路径并发送一个空响应,这是下面的错误.
//----------------------------------------------------
[object File]: {lastModifiedDate: [date] Fri Sep 21 2018 17:42:46 GMT+0530 (India Standard Time), name: "download.jpg", size: 5056, type: "image/jpeg", webkitRelativePath: ""}
upload...
ion-dev.js (157,11)
REGDATAA{"file":{}}
ion-dev.js (157,11)
{"file":{}}
ion-dev.js (157,11)
ERROR …Run Code Online (Sandbox Code Playgroud) jira-rest-api ionic-framework ionic-view ionic-native ionic3
从今天开始,我一直在尝试上传我的 ionic 应用程序,发现谷歌将他们的应用程序规则更改为目标 API 级别 28 及以上,我的目标是 27,以便留下来。
我得到的所有帮助都没有为我工作。尝试 7 后,我已将我的 codova android 升级到 8.0.0,我在 config.xml 中添加了这一行 "" 仍然没有用。请帮忙
我的 config.xml
<widget id="xxx" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>xxx</name>
<description>xxx</description>
<author email="evensatowind@gmail.com" href="http://github.com/satowind">Sato Wind</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="500" /> …Run Code Online (Sandbox Code Playgroud) 我在 ionic 3(旧版)中有一个应用程序,在构建它时,我在文件“GtalkExtensions.pbobjc”的这一部分的 Firebase Messaging 库中收到错误
if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
[worker release];
}
Run Code Online (Sandbox Code Playgroud)
“OSAtomicCompareAndSwapPtrBarrier”的冲突类型
在需要之前,必须从模块“Darwin.libkern.OSAtomic”导入“OSAtomicCompareAndSwapPtrBarrier”声明
函数“OSAtomicCompareAndSwapPtrBarrier”的隐式声明在 C99 中无效
如何解决这个问题我已经完全删除了cocoapods并测试了几个版本,但没有帮助。
Mac Mini M1 Mac 操作系统 Ventura XCode 14.2
如何设置可在所有视图中访问的全局函数?
在app.component.ts中我添加了一个简单的方法
openShare() {console.log("button clicked")}
Run Code Online (Sandbox Code Playgroud)
然后在我的导航中我有
<button ion-button right (click)="openShare()">
<ion-icon name="md-share"></ion-icon>
</button>
Run Code Online (Sandbox Code Playgroud)
当我尝试从任何页面访问它时,我得到以下内容.
self.context.openShare is not a function
Run Code Online (Sandbox Code Playgroud)
但是,如果我将它直接放在构造函数中(例如this.openShare();),它确实执行正常,但是当使用(单击)函数从任何页面调用时它只是不起作用.
app.component.ts不是全局的吗?我认为这是我放置的地方,但也许我错过了一些东西.
基本上它是导航器上一个简单按钮的功能,我需要它是全局的,因为它在每个页面上使用.
任何帮助将不胜感激,仍然可以计算Ionic 2.
如何验证和显示Ionic 2或3中警报控制器中输入的错误
let prompt = Alert.create({
title: 'Alert input validation',
message: "How can I validate below input field?",
inputs: [
{
name: 'email',
placeholder: 'email'
},
],
buttons: [
{
text: 'Save',
handler: data => {
let validateObj = this.validateEmail(data);
if (!validateObj.isValid) {
alert(validateObj.message);
return false;
} else {
//make HTTP call
}
}
}
]
});
Run Code Online (Sandbox Code Playgroud)
有人已经更新了警报控制器,并确实拉动了Ionic团队的请求.我认为Ionic团队规划将来会实现这一点. https://github.com/ionic-team/ionic/pull/12541
我需要一些解决此验证功能的方法.
plnkr http://plnkr.co/edit/IBonfBJngky0h8UtMwMD?p=preview
感谢您的帮助.
ionic3 ×10
angular ×6
typescript ×5
ionic2 ×4
firebase ×2
android ×1
ionic-native ×1
ionic-view ×1
ios ×1
javascript ×1