我正在接管Cordova / Ionic项目。我以前从未与Cordova或Ionic一起工作过,所以我是该领域的初学者。但是,我已经和Node一起工作了几年,所以我对此最了解。
一个简单的开始任务,我需要添加Appsee:
https://www.appsee.com/docs/ios/ionic
这部分很简单:
In case you're using TypeScript (default in ionic 2 and ionic 3) place the following line under the imports:
declare var Appsee:any;
Run Code Online (Sandbox Code Playgroud)
我放在这个文件中:
./src/app/app.component.ts
但是这一部分不太明显:
Call the following method when your app starts, preferably when the deviceready event fires:
Appsee.start("YOUR API KEY");
Run Code Online (Sandbox Code Playgroud)
所以我运行grep来查找deviceready在哪里:
grep -iR "deviceready" * | grep -v node_modules
www/build/vendor.js: * resolve when Cordova triggers the `deviceready` event.
www/build/vendor.js: // prepare a custom "ready" for cordova "deviceready"
www/build/vendor.js: doc.addEventListener('deviceready', function () { …Run Code Online (Sandbox Code Playgroud) //这是我的代码
package name.ratson.cordova.admob.rewardvideo;
import android.util.Log;
import com.google.android.gms.ads.reward.RewardItem;
import com.google.android.gms.ads.reward.RewardedVideoAdListener;
import org.json.JSONException;
import org.json.JSONObject;
import name.ratson.cordova.admob.AbstractExecutor;
class RewardVideoListener implements RewardedVideoAdListener {
private final RewardVideoExecutor executor;
RewardVideoListener(RewardVideoExecutor executor) {
this.executor = executor;
}
@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
synchronized (executor.rewardedVideoLock) {
executor.isRewardedVideoLoading = false;
}
JSONObject data = new JSONObject();
try {
data.put("error", errorCode);
data.put("reason", AbstractExecutor.getErrorReason(errorCode));
data.put("adType", executor.getAdType());
} catch (JSONException e) {
e.printStackTrace();
}
executor.fireAdEvent("admob.rewardvideo.events.LOAD_FAIL", data);
}
@Override
public void onRewardedVideoAdLeftApplication() {
JSONObject data = new JSONObject();
try {
data.put("adType", …Run Code Online (Sandbox Code Playgroud) 通过Ionic中的硬件按钮进行处理的所有解决方案都使用了以下方法:
platform.ready().then(() => {
platform.registerBackButtonAction(() => {
Run Code Online (Sandbox Code Playgroud)
但是,我想知道是否有办法处理导航栏中显示的后退按钮,因为当我在Android中按下它时似乎没有触发.我试图找到的所有解决方案都参考了顶部的代码,它们似乎只适用于硬件按钮.
当我尝试构建离子应用程序时出错.实际上,当我在本地构建时,这不是问题,但是当我在离子网站中检查构建状态时,我得到了一个波纹管错误.
使用 angular5,ionic3
typescript:node_modules/angularfire2/firebase.app.module.d.ts,line:10类'FirebaseApp'错误地实现了接口'FirebaseApp'."FirebaseApp"类型中缺少属性"automaticDataCollectionEnabled".
L9: export declare const FirebaseAppConfigToken: InjectionToken;
L10: export declare class FirebaseApp implements FBApp {
L11: name: string;
Run Code Online (Sandbox Code Playgroud)
我不知道.我应该降级firebase版本吗?
UPDATE
我编辑firebase.app.module.d.ts得像答案,但我现在又得到了另一个错误.我这样编辑.gitignore.
node_modules/*
!node_modules/angularfire2/firebase.app.module.d.ts
Run Code Online (Sandbox Code Playgroud)
npm WARN angularfire2@5.0.0-rc.6.0需要@ firebase/app @ ^ 0.1.6的同行,但没有安装.
错误的ERR!无效的tar标头.也许焦油已损坏或需要喷枪?
错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR!
/home/gitlab-runner/.npm/_logs/2018-04-20T07_49_29_110Z-debug.log
我想实现多语言功能。我遵循了https://ionicframework.com/docs/developer-resources/ng2-translate/。但是我得到Object(...)不是TranslateService.get错误的函数
我已经在Google搜索此错误,但是没有运气。我遵循了这个https://codesundar.com/lesson/ionic-multi-language-support-i18n/
这是代码
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { HttpClientModule, HttpClient } from '@angular/common/http';
// If I use this I get error …Run Code Online (Sandbox Code Playgroud) 我在页面上有一个离子列表,我想只滚动列表项,而不是整个离子内容.
这是我的代码:
<ion-content scroll="false" no-padding>
<ion-list>
<ion-list-header>Select your Status</ion-list-header>
<ion-scroll style="width:100%; height:100vh" scrollY="true">
<ion-item>
<h2>Available</h2>
</ion-item>
<ion-item>
<h2>Busy</h2>
</ion-item>
<ion-item>
<h2>At school</h2>
</ion-item>
<ion-item>
<h2>At the movies</h2>
</ion-item>
<ion-item>
<h2>At work</h2>
</ion-item>
<ion-item>
<h2>Battery about to die</h2>
</ion-item>
<ion-item>
<h2>Can't talk, text only</h2>
</ion-item>
<ion-item>
<h2>In a meeting</h2>
</ion-item>
<ion-item>
<h2>At the gym</h2>
</ion-item>
<ion-item>
<h2>Sleeping</h2>
</ion-item>
<ion-item>
<h2>Urgent calls only</h2>
</ion-item>
</ion-scroll>
</ion-list>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
我想修复列表标题"选择你的状态"并仅滚动其他列表项,但即使我已将scroll ="false"设置为ion-content,它也会隐藏列表标题.请帮忙.提前致谢.
我正在开发一个使用Vue.js和Ionic的应用程序,但是我不知道为什么更新Ionic核心版本会破坏ion-content标签,我尝试使用Google搜索来检查该标签是否已停用,但似乎没有确实如此。
为了说明,我举了一个使用离子芯的例子。使用最新的Ionic版本,不会显示ion-content标签,但是如果切换到旧的Ionic版本,则显示就很好。
<head>
<meta charset="UTF-8">
<title>Ionic Test</title>
<script src="https://unpkg.com/@ionic/core@latest/dist/ionic.js"></script>
<!-- <script src="https://unpkg.com/@ionic/core@0.0.2-30/dist/ionic.js"></script> -->
</head>
<body>
<ion-app>
<ion-page>
<ion-header>
<ion-toolbar>
<ion-title>Example</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="content" padding>
<ion-list>
</ion-item>
<ion-label full>I'm an example text...</ion-label>
<ion-button>Example button</ion-button>
</ion-item>
</ion-list>
</ion-content>
</ion-page>
</ion-app>
</body>
Run Code Online (Sandbox Code Playgroud)
这是此代码的jsFiddle:https ://jsfiddle.net/telmo/chk9h080/
有人可以告诉我这里发生了什么吗?
<div *ngIf="testList.length > 0">
<ion-item *ngFor="let member of testList">
<ion-label>{{member?.testName || 'N/A'}}</ion-label>
<ion-checkbox color="dark" [(ngModel)]="member.checked"></ion-checkbox>
</ion-item>
</div>
[{testID: 1, testName: " test1", testAmount: "500", testDescription: ""},
{testID: 2, testName: " test2", testAmount: "500", testDescription: ""},
{testID: 3, testName: "dgdfgd", testAmount: "150", testDescription: ""},
{testID: 4, testName: "UricAcid", testAmount: "200", testDescription: ""}]
<button (click)="gettstdata()">Done</button>
Run Code Online (Sandbox Code Playgroud)
单击“完成”按钮时如何获取所有复选框值(例如多选)
我是Ionic的新手并使用Ionic 3.9.2
我有几个终端命令来为我的离子应用程序提供服务,但是,这两个命令之间我没有任何区别.
ionic serve
Run Code Online (Sandbox Code Playgroud)
和
ionic serve -c
Run Code Online (Sandbox Code Playgroud) 我正在使用Angular/Firebase在Ionic中构建应用程序.
我想在我的Android设备上测试应用程序,以前已经完美运行了.但是,最近我因为收到错误而无法运行它.
$ ionic cordova run android --device --prod
Run Code Online (Sandbox Code Playgroud)
然后会导致错误:
Running app-scripts build: --prod --platform android --target cordova
[15:36:05] build prod started ...
[15:36:05] clean started ...
[15:36:05] clean finished in 6 ms
[15:36:05] copy started ...
[15:36:06] deeplinks started ...
[15:36:06] deeplinks finished in 270 ms
[15:36:06] ngc started ...
[15:36:19] ngc finished in 12.61 s
[15:36:19] preprocess started ...
[15:36:19] preprocess finished in 1 ms
[15:36:19] webpack started ...
[15:36:19] copy finished in 13.84 s
[15:37:27] webpack finished …Run Code Online (Sandbox Code Playgroud) ionic-framework ×10
ionic3 ×4
angular ×2
cordova ×2
ionic2 ×2
admob ×1
firebase ×1
ion-checkbox ×1
ionic4 ×1
multilingual ×1
npm ×1
typescript ×1