我想要实现的是当我点击下载按钮它应该做的其他事情,当点击该项目时,它应该打开一个新的窗口
<ion-list>
<ion-item *ngFor="let reading_material of reading_materials" (click)="gotoReadingMaterial(reading_material)">
{{reading_material.title}}
<ion-icon item-right name="download" (click)="downloadMaterial(reading_material)"></ion-icon>
</ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud)
但是当我点击下载按钮时,两个事件都会被点击.当我点击下载按钮时,有没有办法可以抑制项目事件?
我目前在Ionic 2应用程序上有一个列表,并且分隔符仅在最后一个元素上是全宽度.结果如下:
我希望所有元素都具有全宽边框.在文档中找不到任何关于此的内容..请提前感谢您的帮助!
编辑:这是我的代码:
<ion-list no-padding="">
<ion-item *ngFor='let like of likes' (click)="goTo(like.qrcode)" text-wrap>
<ion-thumbnail item-left>
<img class="item item-thumbnail-left" [src]="like.logo">
</ion-thumbnail>
<h2>{{like.name}}</h2>
<h3 class="establishment">{{like.type}}<br /></h3>
<p class="establishment">{{like.city}}<br /></p>
<!--<button ion-button clear item-right>View</button>-->
</ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud) 我要开始一个Ionic 2应用程序,它应该是阿拉伯语,所以我需要使用RTL布局,我选择了侧面菜单模板
通过以下行将应用程序配置为RTL可以完美地改变每个方向,除了后退按钮应该指向正确的方向
<ion-nav #content [root]="rootPage" dir="rtl"></ion-nav>
Run Code Online (Sandbox Code Playgroud)
导航栏现在看起来像这样
在Ionic团队关注RTL相关问题之前,是不是有任何修复方法?
我目前面临着在多项选择问题上构建表格的问题.此时,单选的形式运作良好,只留下多项选择题.我想要的目标是这样的:
{
"questions": [
// if multiple choices question
{
"question_id": 17,
"answer_ids": [81,82,83]
},
{
"question_id": 20,
"answer_ids": [101,102,104]
}
]
}
Run Code Online (Sandbox Code Playgroud)
survey.ts
this.surveyForm = this.formBuilder.group({
questions: formBuilder.array([])
})
for (var i = 0; i < this.questions.length; i++) {
if(this.questions[i].question_type == '2') {
// get multiple
let question = formBuilder.group({
question_id: [this.questions[i].id, Validators.required],
answer_ids: formBuilder.array([])
});
this.surveyForm.controls['questions'].push(question);
// for (var j = 0; j < this.questions[i].answers.length; j++) {
// console.log(j);
// let answer = formBuilder.array(this.questions[i].answers)
// console.log(answer)
// …Run Code Online (Sandbox Code Playgroud) 我有一个ion-textarea用户可以写一些内容,我想在点击一个按钮后得到这个文本.
这是html:
<ion-row>
<ion-item>
<ion-textarea [(ngModel)]="myInput" (ionInput)="getItems($event)" placeholder="New Info"></ion-textarea>
</ion-item>
</ion-row>
Run Code Online (Sandbox Code Playgroud)
<button ion-button class="card-button" color="secondary"
(click)="addInfo()"> <ion-icon name="add-circle" class="icona-bottone"></ion-
icon>Add Info</button>
Run Code Online (Sandbox Code Playgroud)
我已经尝试在我的.ts文件中执行此操作:
getItems(textarea) {
// set q to the value of the textarea
var q = textarea.srcElement.value;
this.textSearch = q;
}
addInfo(){
console.log("You wrote " + this.textSearch)
}
Run Code Online (Sandbox Code Playgroud)
但它打印出"你写的undefined".将文本作为字符串并使用它的正确方法是什么?
从我的代码示例中。
tabs: object = [
{ key: 'tab1', value: 'tab1' },
{ key: 'tab2', value: 'tab2' },
{ key: 'tab3', value: 'tab3' },
];
Run Code Online (Sandbox Code Playgroud)
<div [ngSwitch]="my_tab">
<div *ngFor="let tab of tabs" *ngSwitchCase="'{{ tab.key }}'">
{{ tab.value }}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我总是收到此代码的错误。这该怎么做?
我正在构建一个离子应用程序,我在底部使用离子选项卡导航整个应用程序..我想添加自定义svg作为选项卡图标.我不知道如何做到这一点,但如果有任何解决方案,请提供链接或代码或文档的任何参考.
嗨,您好!!我正在构建一个离子应用程序,我在底部使用离子选项卡导航整个应用程序..我想添加自定义svg作为选项卡图标.我不知道如何做到这一点,但如果有任何解决方案,请提供链接或代码或文档的任何参考.
我还想在离子标签中添加头像.
我正在使用ionic 3和firebase firestore作为数据库进行项目.
但是,每当我进行CRUD操作时,我的firebase firestore都会显示警告.
index.esm.js:77 [2018-05-02T05:45:40.408Z] @firebase/firestore:
Firestore (4.13.0):
The behavior for Date objects stored in Firestore is going to change
AND YOUR APP MAY BREAK.
To hide this warning and ensure your app does not break, you need to
add the
following code to your app before calling any other Cloud Firestore
methods:
const firestore = firebase.firestore();
const settings = {/* your settings... */ timestampsInSnapshots:
true};
firestore.settings(settings);
With this change, timestamps stored in Cloud Firestore will be read …Run Code Online (Sandbox Code Playgroud) 这是父页面
<div>
<component></component>
<div>
Run Code Online (Sandbox Code Playgroud)
这将重定向到该组件,我现在已经在其中创建了一个表单,我想获取我在父页面的子页面上的表单中填写的数据
<h5> Type of house </h5>
<ion-item>
<ion-label stacked> </ion-label>
<ion-select [(ngModel)]="Type" placeholder="type of house">
<ion-option value="self"> a </ion-option>
<ion-option value="got" selected> b </ion-option>
</ion-select>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
有一个简单的形式
我知道如何将数据从父级传递给子级,但是我不知道如何使用@output将数据从父级传递给父级
我正在与ionic一起工作,并构建了一个使用cordova-plugin-firebase进行消息传递和分析插件的应用程序。
当我为Android构建此应用时,我去了android studio进行测试,但gradle未同步。首先,我收到一个错误“找不到ID为'com.google.gms.google-services'的插件”。
为了解决这个问题,我在/app/gradle.build的buildscript中放置了“ classpath'com.google.gms:google-services:4.0.2'”依赖项。
现在我得到这个错误:
无法添加名称为“ googleServices”的扩展程序,因为已经使用该名称注册了扩展程序。
有人有同样的错误吗?
谢谢大家的帮助。
这是gradle.build
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
repositories {
mavenCentral();
jcenter()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.1.0'
}
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html
ext {
apply from: '../CordovaLib/cordova.gradle'
// The value …Run Code Online (Sandbox Code Playgroud)