我的 ngFor 有问题:对于列表中的每个项目,我都有一个图像,通过单击我想仅显示该图像的详细信息。问题是,如果我单击图像,列表中所有项目的详细信息都会显示出来。
.html:
<div class=" gif" *ngFor="let r of result">
<img [src]="r.images.downsized.url" alt="image" (click)="getDetails()">
<div class="v3" *ngIf="this.clicked">
<ion-list>
<ion-item>
<ion-label>
<h2>username: {{r?.username}}</h2>
<h3>title: {{r?.title}}</h3>
<p>import date:{{r?.import_datetime}}</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
.ts:
ngOnInit() {
this.clicked = false
}
getDetails(): void {
if (!this.clicked) {
this.clicked = true
}
else {
this.clicked = false
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 Ionic 6 做一个 ionic 项目,我的表单中需要一个日期时间字段。
<ion-content>
<ion-grid>
<ion-row>
<ion-col>
<ion-item>
<ion-label>Available From</ion-label>
<ion-datetime min="1994-03-14" max="2012-12-09" value="2008-09-02"></ion-datetime>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
从我在许多来源中搜索到的内容来看,正确的行为似乎应该是按钮,即单击该按钮时将显示从页面底部向上的滑块。选择器显示可滚动列,可用于单独指定年、月、日、小时和分钟的值。
相反,我得到的是显示选择器而不是按钮或任何东西。
我错过了什么吗?我尝试了文档中的所有用法示例,它们都像这样显示。请帮忙。
我正在使用 Angular-Fire 在 Ionic-Capacitor 上进行 Firebase 身份验证。它在 Web 和 Android 上运行良好,但在 IOS 上不行。
当我检查应用程序网络活动时,我意识到应用程序能够从 firebase 成功获取身份验证响应,但它无法完成异步调用。
我的app.module.ts
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot({mode: 'ios'}), AppRoutingModule,
HttpClientModule,
AngularFireModule.initializeApp(environment.firebaseConfig),
AngularFireAuthModule,
AngularFirestoreModule
]})
Run Code Online (Sandbox Code Playgroud)
这就是我初始化 Angular fire 的方式。
javascript ionic-framework firebase-authentication capacitor
我在 Windows 上安装了新版本的 Android Studio(请参阅下面的版本) 现在,当我npx cap open android在离子电容器中运行时,出现以下错误。
我尝试更改 PATH 环境变量但没有成功。Android Studio 现已安装在
C:\Program Files\Android\Android Studio1
Run Code Online (Sandbox Code Playgroud)
以前是
C:\Program Files\Android\Android Studio
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏。
安卓工作室版本:
Android Studio Bumblebee | 2021.1.1 Patch 1
Build #AI-211.7628.21.2111.8139111, built on February 2, 2022
Runtime version: 11.0.11+9-b60-7590822 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40)
Run Code Online (Sandbox Code Playgroud) 我正在开发 ionic/Angular 中的应用程序,我已将操作系统更新为 MacOs Monterrey,并且还更新了 xCode。
现在,当我创建新页面时,它会发出以下警报:
The 'path' option in '/../../node_modules/@ionic/angular-toolkit/page/schema.json' is using deprecated behaviour. 'workingDirectory' smart default provider should be used instead.
Run Code Online (Sandbox Code Playgroud)
到目前为止,页面已创建并且工作正常,但我尚未找到有关此问题的任何文档。
请,如果有人可以帮助我提供信息
问候
我在一个项目中使用 Ionic 6 和电容器。
在 config.xml 文件中我有:
<widget xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">
Run Code Online (Sandbox Code Playgroud)
当我尝试将其更改为:
<widget version="0.0.1" xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">
Run Code Online (Sandbox Code Playgroud)
然后执行 ionic build android 版本消失,AndroidManifest.xml 文件中没有任何更改。
当我将 apk 或其他文件导入 google play 进行测试时,它告诉我该版本已经存在。
那么如何更改应用程序版本呢?
从 迁移cordova到后capacitor,我在运行时收到以下错误ionic s
vendor.js:114293 ERROR Error: Uncaught (in promise): Error: Not implemented on web.
Error: Not implemented on web.
at AppWeb.unimplemented (vendor.js:1941:12)
at node_modules_capacitor_app_dist_esm_web_js.js:40:19
at Generator.next (<anonymous>)
at asyncGeneratorStep (vendor.js:234184:24)
at _next (vendor.js:234206:9)
at vendor.js:234213:7
at new ZoneAwarePromise (polyfills.js:9384:21)
at vendor.js:234202:12
at AppWeb.getInfo (node_modules_capacitor_app_dist_esm_web_js.js:41:7)
at vendor.js:1704:23
at resolvePromise (polyfills.js:9124:19)
at polyfills.js:9019:9
at polyfills.js:9036:25
at rejected (vendor.js:67367:89)
at _ZoneDelegate.invoke (polyfills.js:8112:158)
at Object.onInvoke (vendor.js:136063:25)
at _ZoneDelegate.invoke (polyfills.js:8112:46)
at Zone.run (polyfills.js:7853:35)
at polyfills.js:9197:28
at _ZoneDelegate.invokeTask (polyfills.js:8145:171)
Run Code Online (Sandbox Code Playgroud)
有人知道我错过了什么吗?
我已经解决了这个问题,只是将其放在这里供任何遇到同样问题的人使用:
当我尝试上传 Ionic 应用程序的 Android 版本时,Google Play 开发者控制台告诉我,我需要 31 的 Target SDK。
我可以通过更新我的config.xml这条线来更新它
<preference name="android-targetSdkVersion" value="31" />
Run Code Online (Sandbox Code Playgroud)
但是,当我构建我的应用程序时,它会失败并出现以下错误,并且没有任何真正指示下一步该做什么
Task :CordovaLib:compileReleaseJavaWithJavac FAILED
An exception has occurred in the compiler (1.8.0_202). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
FAILURE: Build failed with an exception. …Run Code Online (Sandbox Code Playgroud) 在尝试使用电容器构建离子项目时,有人遇到这个问题吗?
我有一个 Ionic 项目,其中每个功能都有不同的包。我正在尝试使用将我的项目导出到 android studio 中ionic capacitor build android。我还尝试创建一个带有空白页面的新项目,效果很好。我的怀疑是本地软件包,但我不知道如何解决这个问题,因为我是角度和离子的新手。
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @ionic-native/core@5.36.0
npm ERR! Found: rxjs@7.4.0
npm ERR! node_modules/rxjs
npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/common@15.0.2
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"15.0.2" from @angular/forms@15.0.2
npm ERR! node_modules/@angular/forms
npm ERR! peer @angular/forms@">=12.0.0" from @ionic/angular@6.3.9
npm ERR! node_modules/@ionic/angular
npm ERR! @ionic/angular@"^6.3.9" from the root project
npm ERR! 1 more (the root project)
npm …Run Code Online (Sandbox Code Playgroud) 我想像离子存储的官方文档一样做到这一点。但它说“index.d.ts(9, 9):这可能意味着声明 IonicStorageModule 的库 (@ionic/storage-angular) 与 Angular Ivy 不兼容。检查是否有更新版本的库可用,如果是的话更新。还可以考虑与库的作者核实,看看该库是否与 Ivy 兼容。”
我怎样才能摆脱这个错误?
我的代码看起来 app.module.ts 看起来像这样:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { IonicStorageModule } from '@ionic/storage-angular';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, IonicStorageModule.forRoot()],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy}],
bootstrap: [AppComponent],
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud) ionic-framework ×10
angular ×4
capacitor ×4
cordova ×2
javascript ×2
android ×1
ionic6 ×1
rxjs ×1
rxjs7 ×1
typescript ×1