标签: ionic3

如何改变离子2中离子头的背景颜色?

如何更改标题颜色?我试过下面但没有成功

 <ion-header>
  <ion-navbar danger>
    <ion-title>TITLE</ion-title>
  </ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)

我的variable.scss是:

$colors: (
  primary:    #387ef5,
  secondary:  #32db64,
  danger:     #f53d3d,
  light:      #f4f4f4,
  dark:       #222
);
Run Code Online (Sandbox Code Playgroud)

css sass ionic-framework ionic2 ionic3

14
推荐指数
3
解决办法
3万
查看次数

Angular 4:如何在subscribe中使用await/async

我可以诚实地说,角度等待/异步真的是一个很棒的东西,它减少了很多大括号,提高了可读性并防止了很多人为错误.然而,有一件事困扰我很多.如何在subscribe中使用await/async.

让我们说吧

 @Injectable()
export class TableCom extends BaseCom {
  public subject = new Subject<any>();

}
Run Code Online (Sandbox Code Playgroud)

TableCom是一个提供者,用作信号器组件和页面组件之间的通信器.

所以在页面组件构造函数中,它使用可观察主题从signalr组件接收新数据,如下所示.

constructor(protected nav: NavController,
        protected db: Storage,
        protected alert: AlertController,
        protected order: OrderData,
        protected translate: TranslateService,
        public navParams: NavParams,
        public toastCtrl: ToastController,
        private table_data: TableData,
        private load: LoadingController,
        private http: Http,
        private com_table: TableCom

    )
    {
        super(nav, db, alert, order, translate, undefined, false);
        this.previous_page = navParams.get('previous_page');
        this.subscribe_table = this.com_table.Receive().subscribe(res =>
        {
            await this.SaveTableAsync(res.data);
            this.ReadTableAsync();
        });
    }
Run Code Online (Sandbox Code Playgroud)

问题是this.ReadTableAsync()基本上必须等待this.SaveTableAsync才能在启动之前完成.等待可以在这里实现吗?先感谢您 !!

typescript ionic-framework ionic3 angular

14
推荐指数
1
解决办法
5万
查看次数

Cordova config.xml环境变量

场景:

我正在构建一个Ionic3应用程序,我config.xml有一些数据,我希望能够根据我的环境进行更改(例如,我希望我的facebook app id具有不同的开发,分期和生产价值).

我实现了这个创建模板config.xml(文件是config.tpl.xml)和一个before_prepare cordova钩子,用正确的值替换模板中的变量并保存生成的内容config.xml.

所述cordova钩使用npmes6-template-strings:

npm install es6-template-strings --save-dev
Run Code Online (Sandbox Code Playgroud)

钩子是:

#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var compile = require('es6-template-strings/compile');
var resolveToString = require('es6-template-strings/resolve-to-string');

var ROOT_DIR = process.argv[2];
var FILES = {
    SRC: "config.tpl.xml",
    DEST: "config.xml"
};

var env = process.env.NODE_ENV || 'dev';
var envFile = 'src/environments/environment.' + env + '.json';

var srcFileFull = path.join(ROOT_DIR, FILES.SRC); …
Run Code Online (Sandbox Code Playgroud)

cordova ionic3

14
推荐指数
1
解决办法
3235
查看次数

API错误:<_UIKBCompatInputView:0x13fd1d7c0; frame =(0 0; 0 0); layer = <CALayer:0x1c4426e40 >>返回0宽度,假设UIViewNoIntrinsicMetric

我正在iPhone 7上使用Ionic 3和iOS 11.当我运行我的应用程序,并填写一些文本/输入字段(基本形式)时,应用程序会冻结几秒钟而变得完全没有响应(这不好,不要说至少).我注意到Xcode中出现了这个错误,也许这就是问题所在.有没有其他人遇到类似的错误?

API错误:<_UIKBCompatInputView:0x13fd1d7c0; frame =(0 0; 0 0); layer =>返回0宽度,假设UIViewNoIntrinsicMetric

ionic-framework ionic2 ionic3

14
推荐指数
1
解决办法
3100
查看次数

IONIC:实用程序CLI意外关闭

当我运行离子服务时出现此错误Ionic CLI将退出.请检查上面的任何输出以获取错误详情.

我的离子信息

$ionic info
Ionic:

   ionic (Ionic CLI)  : 4.0.1 (C:\Users\Pc\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.8

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0

System:

   Android SDK Tools : 25.3.1
   NodeJS            : v6.10.1 (C:\Program Files\nodejs\node.exe)
   npm               : 5.3.0
   OS                : Windows 10

Environment:

   ANDROID_HOME : C:\Users\Pc\AppData\Local\Android\sdk
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionic-view ionic3

14
推荐指数
4
解决办法
5万
查看次数

如何在 Chrome Mac 中禁用 cors

开发我的离子应用程序时,我不断收到以下错误。这是后端不允许的授权标头。

在此输入图像描述

尝试过的解决方案:

在此输入图像描述

  • 以及启动 chrome 禁用网络安全,如下所示

打开 -a Google\ Chrome --args --disable-web-security --user-data-dir

但我仍然无法绕过cors检查,错误仍然存​​在。需要一些帮助。

cors ionic-framework ionic2 ionic3 angular

14
推荐指数
3
解决办法
7万
查看次数

如何解决"错误:未捕获(承诺):错误:没有提供"Ionic 3中的错误

我正在学习Ionic 3,当我尝试制作一个检查唯一用户名的自定义验证器时,我遇到了这个错误.我尽我所能但无法解决这个问题.

CustomValidators.ts

import { Directive, Input } from '@angular/core';

import { FormControl, Validator, AbstractControl } from '@angular/forms';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import {Observable} from 'rxjs/Rx';

export class CustomValidators {


    constructor(public http: Http){}

      public hasUniqueEmail(
        control: FormControl,
      ){

        return this.http.get('assets/users.json')
        .map(res => res.json())
        .catch((error:any) => Observable.throw(error.json().error || 'Server error'));

      }


}
Run Code Online (Sandbox Code Playgroud)

signup.ts

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { FormBuilder, FormGroup,  Validators } from '@angular/forms';
import …
Run Code Online (Sandbox Code Playgroud)

javascript ionic3 angular

13
推荐指数
1
解决办法
3万
查看次数

接收NPM错误:离子3项目中位置20938处的JSON中的意外字符串

不确定错误在哪里.(*是举行私人项目信息的地方,即Facebook应用程序ID和应用程序名称)我已经收到此错误一段时间了,我无法弄清楚,有什么我想念的吗?

{
    "name": "****",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.4.3",
        "@angular/compiler": "4.4.3",
        "@angular/compiler-cli": "4.4.3",
        "@angular/core": "4.4.3",
        "@angular/forms": "4.4.3",
        "@angular/http": "4.4.3",
        "@angular/platform-browser": "4.4.3",
        "@angular/platform-browser-dynamic": "4.4.3",
        "@firebase/webchannel-wrapper": "^0.2.1",
        "@ionic-native/camera": "^4.3.0",
        "@ionic-native/core": "^4.3.1",
        "@ionic-native/facebook": "^4.2.1",
        "@ionic-native/image-picker": "^4.3.1",
        "@ionic-native/splash-screen": "4.3.1",
        "@ionic-native/status-bar": "4.3.1",
        "@ionic/storage": "2.0.1",
        "angularfire2": "^5.0.0-rc.2",
        "cordova-browser": "^4.1.0",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-facebook4": "^1.9.1",
        "cordova-plugin-firebase": …
Run Code Online (Sandbox Code Playgroud)

json node.js ionic3

13
推荐指数
1
解决办法
5719
查看次数

离子cordova在PANIC中运行android结果:缺少'x86'CPU的模拟器引擎程序

经过大量搜索后,我运行时无法解决此错误:

ionc cordova run android -ls

OUTPUT:

ANDROID_HOME=/Users/lucianokrebs/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
No target specified and no devices found, deploying to emulator        
No emulator specified, defaulting to Nexus_5_API_P

Waiting for emulator to start...

PANIC: Missing emulator engine program for 'x86' CPU.
Run Code Online (Sandbox Code Playgroud)

而模拟器永远不会启动

另外,当我跑:

$ ${ANDROID_SDK_ROOT}/tools/emulator -avd my-custom-avd

我有: PANIC: Missing emulator engine program for 'x86' CPU.

但是,当我跑:

$ ${ANDROID_SDK_ROOT}/emulator/emulator -avd my-custom-avd

模拟器启动并正常工作

似乎cordova在尝试启动模拟器时设置了错误的路径.有人已经处理过了吗?

ionic info:
    cli packages: (/usr/local/lib/node_modules)
    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) …
Run Code Online (Sandbox Code Playgroud)

android cordova ionic-framework ionic3

13
推荐指数
2
解决办法
9788
查看次数

TypeError:Object(...)不是函数

使用ionic3,angularfire2 v5

TypeError:Object(...)不是SwitchMapSubscriber._next上的SwitchMapSubscriber.project(http:// localhost:8100/build/vendor.js:73935:76)的函数(http:// localhost:8100/build/vendor.js:61778:27)在SwitchMapSubscriber.Subscriber.next(http:// localhost:8100/build/vendor.js:20750:18)的RefCountSubscriber.Subscriber._next(http:// localhost:8100/build/vendor.js:20786:26)在Subject.next(http:// localhost:8100/build/vendor)的RefCountSubscriber.Subscriber.next(http:// localhost:8100/build/vendor.js:20750:18). js:23237:25)在ConnectableSubscriber.Subscriber._next(http:// localhost:8100/build/vendor.js:20786:26)的ConnectableSubscriber.Subscriber.next(http:// localhost:8100/build/vendor. js:20750:18)在Asification.observe(http:// localhost:8100/build/vendor.js:51866:50)的AsyncAction.DelaySubscriber.dispatch(http:// localhost:8100/build/vendor.js: 76246:40)

home.ts

TypeError: Object(...) is not a function
    at SwitchMapSubscriber.project (http://localhost:8100/build/vendor.js:73935:76)
    at SwitchMapSubscriber._next (http://localhost:8100/build/vendor.js:61778:27)
    at SwitchMapSubscriber.Subscriber.next (http://localhost:8100/build/vendor.js:20750:18)
    at RefCountSubscriber.Subscriber._next (http://localhost:8100/build/vendor.js:20786:26)
    at RefCountSubscriber.Subscriber.next (http://localhost:8100/build/vendor.js:20750:18)
    at Subject.next (http://localhost:8100/build/vendor.js:23237:25)
    at ConnectableSubscriber.Subscriber._next (http://localhost:8100/build/vendor.js:20786:26)
    at ConnectableSubscriber.Subscriber.next (http://localhost:8100/build/vendor.js:20750:18)
    at Notification.observe (http://localhost:8100/build/vendor.js:51866:50)
    at AsyncAction.DelaySubscriber.dispatch (http://localhost:8100/build/vendor.js:76246:40)
Run Code Online (Sandbox Code Playgroud)

home.html的 …

angularfire2 ionic3

13
推荐指数
1
解决办法
3万
查看次数