我正在尝试在 ionic 4 中实现 popover 并且它为我显示了这个错误,我已经为 popover 创建了一个独特的组件并且我正在页面上实现,所以我点击按钮来创建它给这个的组件错误。
我正在使用延迟加载并将模块导入文件,我做错了什么?
ERROR Error: "Uncaught (in promise): Error: No component factory found for ProfileComponent. Did you add it to @NgModule.entryComponents?
Run Code Online (Sandbox Code Playgroud)
弹出模块
ERROR Error: "Uncaught (in promise): Error: No component factory found for ProfileComponent. Did you add it to @NgModule.entryComponents?
Run Code Online (Sandbox Code Playgroud)
页面模块:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ProfileComponent } from './profile.component';
@NgModule({
declarations: [ProfileComponent],
imports: [
CommonModule,
],
entryComponents: [ProfileComponent],
})
export class ProfileModule { } …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用formControl使该选项在Ionic Select 中显示为选中状态,但是它不起作用,该值是在表单中设置的,当我键入 console.log (this.form) 时,该字段的值会出现,但是它没有出现在 select 中,是空白的。
我正在使用 ionic 4 版本。
HTML:
<!-- Analysis Mode -->
<ion-col size="12">
<ion-label class="custom-label" stacked>Modo de Análise</ion-label>
<ion-select formControlName="analysis_mode" interface="popover">
<ion-select-option value="1">Aleatório</ion-select-option>
<ion-select-option value="2">Sequencial</ion-select-option>
</ion-select>
</ion-col>
Run Code Online (Sandbox Code Playgroud)
形式:
this.form = this.formBuilder.group({
analysis_mode: new FormControl(null, Validators.required),
value: new FormControl(null, Validators.required),
});
this.form.controls['analysis_mode'].setValue(1);
Run Code Online (Sandbox Code Playgroud) 我正在尝试ngx-translate与我的Ionic 4项目一起使用,我已经遵循了本指南。它在我的浏览器中运行良好,但是当我在我的 android 设备上构建和测试时它无法转换。
我已经使用npm然后添加到导入中安装了它,创建了函数并将标签添加到我的 HTML 中。
这是我的代码
安装使用:
npm install @ngx-translate/core @ngx-translate/http-loader --save
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 {SplashScreen} from '@ionic-native/splash-screen/ngx';
import {StatusBar} from '@ionic-native/status-bar/ngx';
import {AppComponent} from './app.component';
import {AppRoutingModule} from './app-routing.module';
import {CallNumber} from '@ionic-native/call-number/ngx';
import {Camera} from '@ionic-native/camera/ngx';
import { AuthServiceService } from './auth-service.service';
import { IonicStorageModule } from '@ionic/storage';
import { TranslateModule, …Run Code Online (Sandbox Code Playgroud) 在我的 ionic 3 项目中,按钮图标没有居中。当我在浏览器中测试时,它可以正常工作,在 android 设备中它也可以正确显示在中心。
但只有在 ios 设备中,它才不会显示在中心。
上面的屏幕截图来自 ios 设备。因为 +,- 符号没有在中心对齐。
html代码:
<ion-col style="display: contents">
<button primary large class="inbtn" (click)="decrement()">
<ion-icon name="remove" ></ion-icon>
</button>
<h2 style="margin-left: 7px;margin-top: 0px;font-size: 2.4rem;"><b>{{currentNumber}}</b></h2>
<button primary large class="inbtn" (click)="increment()" >
<ion-icon name="add" ></ion-icon>
</button>
</ion-col>
Run Code Online (Sandbox Code Playgroud)
css:
.inbtn{
height: 30px;
width: 30px;
display: inline-block;
border-radius: 50%;
font-size: large;
font-weight: 500;
margin-left: 7px;
vertical-align: middle;
background-color: #d8d8d8 !important;
text-align: center;
-webkit-appearance: none;
}
Run Code Online (Sandbox Code Playgroud) 我有一台需要通过 WiFi 连接到我的 Android 设备的热敏打印机。我需要在触发按钮时自动打印它(没有打印对话框)
目前,我使用的是 Ionic 4,但我找不到任何支持 ESC/POS 语言的库。我可以使用任何图书馆?
注意:以下解决方案适用于 Ionic 4 和 5。
我有一个 Ionic 4 应用程序,我想要一个透明的内容。
这不起作用,并且内容始终为白色。我也将其添加到 css 中:
ion-content{
--ion-background-color: transparent;
}
Run Code Online (Sandbox Code Playgroud)
我想在滚动时隐藏和显示我的标签栏。想要在用户向下滚动时隐藏它并在向上滚动时显示它。onScroll方法中如何判断方向?
下面是我的 onScroll 函数:
onScroll($event: CustomEvent<ScrollDetail>) {
if ($event && $event.detail && $event.detail.scrollTop) {
let scrollTop = $event.detail.scrollTop;
console.log($event, scrollTop);
document.querySelector('ion-tab-bar').style.display = 'none';
}
}
Run Code Online (Sandbox Code Playgroud) 我相信该插件FingerprintAIO可能不受ionic 4.
当我使用下面的命令来安装cordova和ionic插件全部似乎罚款:
ionic cordova plugin add cordova-plugin-fingerprint-aio
npm install @ionic-native/fingerprint-aio
Run Code Online (Sandbox Code Playgroud)
在我的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 { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import {FingerprintAIO} from '@ionic-native/fingerprint-aio';
@NgModule({
declarations: [AppComponent],
entryComponents: [], …Run Code Online (Sandbox Code Playgroud) 我正在尝试将此 ionic 3 代码转换为 ionic 4,但我不知道 promise 如何在 ionic 4 上工作。我尝试查看文档,但找不到任何 promise 的解决方案
async generateAlert(header, message, ok, notOk): Promise<boolean> {
return new Promise((resolve, reject) => {
let alert = await this.alertController.create({
header: header,
message: message,
buttons: [
{
text: notOk,
handler: _=> reject(false)
},
{
text: ok,
handler: _=> resolve(true)
}
]
})
await alert.present();
});
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试获取单个帖子的详细信息,但我不断收到此错误;错误类型错误:无法读取 Object.eval [as updateRenderer] 中未定义的属性“title”。虽然数据在 console.log 中被正确获取,但它没有显示在页面本身上。当我执行 {{post?.title}} 时,错误消失了,但结果仍然没有出现在页面上,但在 console.log 中正确显示
离子框架:v4 操作系统平台:Windows 10
售后服务
getAllPosts(): Observable<any> {
return this.http.get(`${this.url}`).pipe(
map(results => {
console.log('Raw: ', results);
return results['posts'];
})
);
}
getPost(postId: string) {
return this.http.get(`${this.url}/${postId}`);
}
Run Code Online (Sandbox Code Playgroud)
post.page.ts
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { PostService } from '../post.service';
@Component({
selector: 'app-post',
templateUrl: './post.page.html',
styleUrls: ['./post.page.scss'],
})
export class PostPage implements OnInit {
loadedPost: any;
constructor(private activatedRoute: ActivatedRoute, private postService: PostService) { …Run Code Online (Sandbox Code Playgroud) ionic-framework ×10
ionic4 ×8
angular ×5
css ×2
ionic3 ×2
typescript ×2
cordova ×1
escpos ×1
html ×1
ionic5 ×1
javascript ×1
promise ×1
sass ×1