ionic 复选框在 Android 中显示为方形,但在IOS中显示为圆形。
我们怎样才能让它们在 IOS 上变成正方形呢?
嗨,我已经被一个问题困扰好几天了,到目前为止还没有研究证明足够。我正在尝试在 Ionic 2 中创建一个具有特定类(或 id)的简单模式。
我需要这样简单的东西:
<ion-modal class="myDifficultToAddClass">
...
</ion-modal>
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
import { NavParams, ModalController } from 'ionic-angular';
@Component(...)
class PageBehindTheModal {
constructor(public modalCtrl: ModalController) {
}
presentProfileModal() {
let profileModal = this.modalCtrl.create(Profile, { randomData: randomData });
profileModal.present();
}
}
@Component(...)
class Profile {
constructor(params: NavParams) {
console.log('Some info: ', params.get('randomData'));
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用 Angular/Core 中的 ViewEncapsulation 来封装视图,以便使用本地 css,但该 css 将在全局范围内可用(并且我无法仅“设置”此特定模式的样式 - 所以这不是解决方案):
import { ViewEncapsulation } from '@angular/core';
@Component({
styleUrls: ['./product-details.scss'],
encapsulation: ViewEncapsulation.Emulated
})
Run Code Online (Sandbox Code Playgroud)
我希望找到一个简单的解决方案,例如:
// create(component, data, opts) …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的应用中实现聊天。
我写了一个 autosizing ion-textarea 如下:查看
<ion-footer [keyboardAttach]="content">
<ion-toolbar class="text-input">
<ion-item no-lines>
<ion-textarea autosize
rows="1"
placeholder="Votre message..."
autocomplete="on"
autocorrect="on"
[(ngModel)]="message"
>
</ion-textarea>
<button ion-button small icon-only round item-end color="secondary" (tap)="onSend()">
<ion-icon name="send"></ion-icon>
</button>
</ion-item>
</ion-toolbar>
</ion-footer>
Run Code Online (Sandbox Code Playgroud)
CSS
ion-footer {
ion-toolbar.toolbar.toolbar-ios {
&.toolbar:last-child {
padding-bottom: 0px;
height: auto;
}
}
ion-item.item-textarea {
background-color: transparent;
}
.text-input {
height: auto;
div.input-wrapper {
background-color: #fff;
border-radius: 20px;
textarea.text-input {
margin-left: 8px;
max-height: 100px;
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
指示
import {ElementRef, HostListener, Directive, OnInit, ViewChild} …Run Code Online (Sandbox Code Playgroud) 我正在使用带有延迟加载页面的 Ionic 3。尝试在页面内的组件中显示模式时,出现以下错误:
No component factory found for CourseEditorComponent. Did you add it to @NgModule.entryComponents?
Run Code Online (Sandbox Code Playgroud)
正如你可以看到下面下来,我已经添加了CourseEditorComponent作为entryComponent到courses.modules.ts,其中得到由进口dashboard.modules.ts。
我对 Angular/Ionic 中使用自定义 entryComponents 的方式有什么误解吗?
等级制度
DashboardPage
-CoursesComponent
--CourseEditorComponent
--CourseCreatorComponent
-InstructorsComponent
Run Code Online (Sandbox Code Playgroud)
模块
仪表板.module.ts
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { DashboardPage } from './dashboard';
import { CoursesModule } from "./courses/courses.module";
@NgModule({
declarations: [
DashboardPage
],
imports: [
IonicPageModule.forChild(DashboardPage),
CoursesModule
],
})
export class DashboardPageModule {}
Run Code Online (Sandbox Code Playgroud)
course.module.ts
import { NgModule } from '@angular/core';
import …Run Code Online (Sandbox Code Playgroud) 我有以下 html
<ion-item>
<ion-range min="5" max="300" pin="true" [(ngModel)]="contrast" color="secondary" ionChange=“changeRange(contrast)”>
<ion-icon range-left small name="contrast"></ion-icon>
<ion-icon range-right name="contrast"></ion-icon>
</ion-range>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
结果是:
这是触发方法:
changeRange(valor){
console.log(valor.value);
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我使用 ionChange 来执行 changeRange 方法。但是当我运行它时,我收到以下错误。
我究竟做错了什么?
我尝试对这样的数组进行排序...
...在 Angular2 中。
成分
this.streetDetailRef = this.afDatabase.list('data/users/' + this.currentUserID + '/territory/' + this.sStreet.parentKey + '/' + this.sStreet.key + '/houseNumbers/');
this.streetDetailData = this.streetDetailRef.snapshotChanges().map(changes => {
return changes.map(c => ({ key: c.payload.key, ...c.payload.val() })).sort();
});
Run Code Online (Sandbox Code Playgroud)
我认为的循环
<ion-item-sliding *ngFor="let house of streetDetailData | async | orderBy: 'number':false" #slidingItem>
<strong>{{ house.number }}</strong> ...
Run Code Online (Sandbox Code Playgroud)
'number'在这种情况下是没有字母的干净数字。我将这封信存储在一个单独的 firebase 条目中。但如果需要,肯定可以将它们存储在同一个中。
附加信息:我正在使用 VadimDez 的 ngx-orderBy-pipe:https : //github.com/VadimDez/ngx-order-pipe
我想在 ionic 2/3 中禁用 ion-searchbar 以便只显示搜索栏但我们不能输入任何内容。我添加了,"disabled = true"但这不起作用。
你能提出一些建议吗?
我有一些如何设法搞砸我的 Ionic 项目......一些帮助将不胜感激。
我正在尝试添加,cordova-plugin-camera所以我正在做的是:
$ cordova plugin add cordova-plugin-camera 这将返回一个错误:
Installing "cordova-plugin-camera" for android
Android Studio project detected
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-camera': CordovaError: Uh oh!
"C:\xampp\htdocs\project x\anonymous-social\platforms\android\app\src\main\res\xml\camera_provider_paths.xml" already exists!
at copyNewFile (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:261:45)
at install (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:51:17)
at ActionStack.process (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
at PluginManager.doOperation (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:114:20)
at PluginManager.addPlugin (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:144:17)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\Api.js:247:74
at _fulfilled (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:570:49
(node:26116) UnhandledPromiseRejectionWarning: CordovaError: …Run Code Online (Sandbox Code Playgroud) 我有一个带有复选框的表单,对于某些复选框,以下适用:
当复选框被选中并被点击并且某些语句为真时,复选框不应被取消选中,而是跳回选中状态。
这是当前的html:
<ion-item>
<ion-label stacked [innerHTML]="htmlString"></ion-label>
<ion-checkbox (click)="checkboxClick($event)"></ion-checkbox>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
这是当前的 .ts:
checkboxClick(e){
var statement = true;
if(statement){
e.target.checked = true;
}
}
Run Code Online (Sandbox Code Playgroud)
这是一个展示该问题的堆栈闪电战:https ://stackblitz.com/edit/ionic-tcxd55?file = pages%2Fhome%2Fhome.ts
我想知道当我们在 ionic 3 中默认单击 ion-navbar 后退按钮时调用哪个函数。我想在硬件后退按钮单击时调用相同的函数。
ionic2 ×10
ionic3 ×7
angular ×6
javascript ×2
angularfire2 ×1
back ×1
button ×1
checkbox ×1
cordova ×1
css ×1
dom-events ×1
firebase ×1
html ×1
ios ×1
textarea ×1
typescript ×1