标签: ionic4

尝试运行 ng test 时在 multi styles.css 中收到“ERROR”

将 Angular 升级到 7.2.6 后,我可以成功构建使用,ng build但是当我运行时ng test出现以下错误。我已经尝试styles.css在我的angular.json文件中调整路径,但仍然收到相同的错误。我对正在发生的事情不知所措。我也在使用 Ionic 4。

ERROR in multi ./styles.css
Module not found: Error: Can't resolve '/Users/zsoflin/Documents/GitHub/Layer/styles.css' in '/Users/zsoflin/Documents/GitHub/Layer'
resolve '/Users/zsoflin/Documents/GitHub/Layer/styles.css' in '/Users/zsoflin/Documents/GitHub/Layer'
  using description file: /Users/zsoflin/Documents/GitHub/Layer/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /Users/zsoflin/Documents/GitHub/Layer/package.json (relative path: ./styles.css)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Users/zsoflin/Documents/GitHub/Layer/styles.css doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /Users/zsoflin/Documents/GitHub/Layer/styles.css.ts doesn't …
Run Code Online (Sandbox Code Playgroud)

karma-runner angular ionic4

8
推荐指数
1
解决办法
1974
查看次数

如何在 Ionic 4 中集成 Stripe 支付

我是离子框架的新手,并试图在我的应用程序中集成条纹。我做了一些研究,发现只有这个https://ionicframework.com/docs/native/stripe。它解释得不够好。我如何在 .html 文件上实现这个概念,比如为用户提供一个按钮来触发付款?

我也试过这个https://fireship.io/lessons/stripe-elements-angular/但一路上迷路了。

checkout.page.ts

import { Component, OnInit, Input, HostListener } from '@angular/core';
// import { Stripe } from '@ionic-native/stripe/ngx';
import { AuthService } from '../services/auth.service';
import { FirebaseService } from '../services/firebase.service';
import { AngularFireFunctions } from '@angular/fire/functions';
import { Router } from '@angular/router';

import { Observable, of } from 'rxjs';

declare var Stripe;

@Component({
  selector: 'app-rentals',
  templateUrl: './rentals.page.html',
  styleUrls: ['./rentals.page.scss'],
})
export class RentalsPage implements OnInit {

  user$: Observable<User>;

    constructor(
        private router: Router,
      // …
Run Code Online (Sandbox Code Playgroud)

stripe-payments ionic4 angular7

8
推荐指数
0
解决办法
3156
查看次数

如何在带有电容器的离子中重命名平台“App”

如何将平台应用程序名称从“App”重命名为其他名称?

将平台添加到离子电容器项目时,npx cap add ios它会生成ios/App文件夹,但我想将其命名为ios/my-app.

如果可能的话,我想为不同环境(ios/my-app-testios/my-app-prod)的同一个项目添加两个应用程序。

ionic-framework ionic4 capacitor

8
推荐指数
3
解决办法
6254
查看次数

当按降序时间戳排序时,Firestore startAfter() 在无限滚动中返回相同的数据

我正在使用 Ionic 上的 Firestore 编写一个包含按时间顺序排列的用户帖子(最新帖子在顶部)的个人资料页面,方法是将orderBy () 设置为“时间戳降序。当用户到达底部时,我使用 Ionic 的无限加载来加载更多帖子,但结果是 Firestore 一遍又一遍地加载完全相同的帖子。请帮忙!

你好!

抱歉,如果这是一个初学者问题,但我已经为此思考了几个小时,但无济于事。按升序排列时分页工作正常,但按降序排列时会加载相同的帖子。我已经考虑过尝试以下替代方案,但它们不具有成本效益:

  1. 当用户到达底部时更改限制:这将导致一遍又一遍地阅读所有帖子
  2. 按升序执行但颠倒数组:会破坏分页的目的
  3. 使用查询(where)来获取 x 时间戳之前的文档:理论上可行,但有点老套,我真的很想知道 startAfter() 是如何工作的,因为它已经存在了。

'''

READ_posts__profile(uid,limit, start) : Promise<[]>
  {
      return new Promise((resolve, reject) =>
      {

         if (start == null)
         {
            resolve();
         }
        else if(start == 'head')
        {
            start = new Date();
        }
            console.log(start);


         this._DB.collection(this.ref.posts + uid + '/userposts' )
         .orderBy("timestamp", 'desc').startAfter(start).limit(limit)
         .get()
         .then((querySnapshot) =>
         {

            let obj : any = [];

            console.log(obj);

            querySnapshot
            .forEach((doc : any) => …
Run Code Online (Sandbox Code Playgroud)

javascript pagination ionic4 google-cloud-firestore

8
推荐指数
2
解决办法
2万
查看次数

无法使用 ionic 5+ 中的 ionic 文件传输插件下载文件

在这里,我使用离子文件传输插件下载文件,当我尝试下载文件时,我遇到以下错误

401

而且每次我构建一个文件时,我也需要在 android 中添加以下代码

public class FileProvider extends androidx.core.content.FileProvider
Run Code Online (Sandbox Code Playgroud)

此下载是否还有其他选择。我检查了电容器站点,但我不确定如何使用文件存储插件,下面是我使用文件传输的代码

 pdfUrl = 'https://www.cs.toronto.edu/~hinton/absps/NatureDeepReview.pdf';


  constructor(private transfer: FileTransfer, private file: File) {}

  download() {
    const fileTransfer: FileTransferObject = this.transfer.create();
    const url = this.pdfUrl;
  fileTransfer.download(url, this.file.dataDirectory).then((entry) => {
    console.log('download complete: ' + entry.toURL());
    this.saveData = entry.toURL();

  }, (error) => {
    // handle error
    console.log(error);
  });
Run Code Online (Sandbox Code Playgroud)

javascript ionic-framework angular ionic4 capacitor

8
推荐指数
1
解决办法
220
查看次数

Ionic 4/Angular 6:选项卡中的嵌套子路径

我使用Ionic Tabs Component生成了一个应用程序.

标签是交货,关于联系.

然后我生成了一个页面细节.

我希望页面详细信息成为" 交付"选项卡的子项.

当我在详细信息页面上时,我正在浏览交付选项卡.

有人在Ionic Forum上提出了类似的问题

生成的目录结构:

- about
- contact
- deliveries
    deliveries.module.ts
- details
    details.module.ts
- tabs
    tabs.module.ts
    tabs.page.html
    tabs.router.module.ts
app.module.ts
app-routing.module.ts
Run Code Online (Sandbox Code Playgroud)

这是生成的app-routing.module.ts

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
  { path: '', loadChildren: './tabs/tabs.module#TabsPageModule' },
];
@NgModule({
  imports: [
    RouterModule.forRoot(routes)
  ],
  exports: [RouterModule]
}) …
Run Code Online (Sandbox Code Playgroud)

typescript angular ionic4 angular6

7
推荐指数
2
解决办法
1万
查看次数

在Angular CLI项目结构中创建ionic 4应用

我正在寻找一种“离子启动”项目并将其保存在现有Angular CLI解决方案(已经包含一个Web应用程序和一个lib)的projects文件夹中的方法。

ionic-cli angular-cli ionic4

7
推荐指数
1
解决办法
727
查看次数

“ Ionic V4-构建产品”找不到cordova.js脚本标记。插件加载可能失败。“

在Ionic v4中,当我运行以生产模式捆绑的应用程序时(离子cordova构建android --prod),控制台会说“找不到cordova.js脚本标记。插件加载可能会失败。应用程序的某些内容(如字体)将被卸载(我看到的是Roboto Font,而不是我的自定义字体)。否则,当我试图在没有生产模式的情况下编译**(离子Cordova构建android)**时,该应用程序运行时没有控制台错误。

我的离子信息:

ionic(Ionic CLI):4.12.0 Ionic Framework:@ ionic / angular 4.2.0 @ angular-devkit / build-angular:0.13.8 @ angular-devkit / schematics:7.2.4 @ angular / cli:7.3.8 @离子/角度工具包:1.4.1

科尔多瓦:

cordova(Cordova CLI):8.1.2(cordova-lib@8.1.1)Cordova平台:android 7.1.4 Cordova插件:cordova-plugin-ionic-keyboard 2.1.3,cordova-plugin-ionic-webview 3.1.2, (以及其他7个插件)

有人也面临这个问题吗?

干杯,

cordova angular ionic4

7
推荐指数
1
解决办法
915
查看次数

无法将任务“ processDebugGoogleServices”添加为具有该名称的任务

什么地方出了错? org.gradle.api.internal.tasks.DefaultTaskContainer $ DuplicateTaskException:无法添加任务'processDebugGoogleServices',因为具有该名称的任务已经存在。

I want to test firebase FCM plugin, but it seems to have a lot of errors, 
after solved many of them, here what I'm trying to do: ionic cordova build 
android, I have this error:
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

离子信息:

在此处输入图片说明

platform \ android \ cordova-plugin-fcm-with-依赖性更新:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        mavenLocal()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.+'
        classpath 'com.google.gms:google-services:3.1.+'
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}
repositories {
    mavenCentral()
    jcenter()
}
dependencies {
    compile 'com.google.firebase:firebase-core:10.+'
}
// apply plugin: 'com.google.gms.google-services'
// class …
Run Code Online (Sandbox Code Playgroud)

ionic4

7
推荐指数
2
解决办法
4992
查看次数

错误:在您的PATH上找不到cordova-res

我的应用程序ionic 4中有问题,当我运行时ionic cordova platform add android出现此错误:

[ERROR] cordova-res was not found on your PATH. Please install it globally:
npm i -g cordova-res
Run Code Online (Sandbox Code Playgroud)

而且当我运行时,npm i -g cordova-res我无法安装它。如何解决这个问题呢?

android cordova ionic4

7
推荐指数
5
解决办法
5152
查看次数