小编Rag*_*hav的帖子

如何使用 Ionic 4 项目将 angular 版本更新为 8

我刚刚设置了 Ionic 4 项目,并且有 Angular 7 版本,但我想将 Angular 7 版本更新为 8,我正在运行以下 cmd 但显示错误。

我正在运行的命令:

ng 更新 @angular/cli @angular/core

npm install --save-dev @angular-devkit/build-angular

即将出现的错误:

无法从“/home/Projects/myProjectName”找到模块“@angular-devkit/build-angular”。错误:无法从“/home/Projects/myProjectName”中找到模块“@angular-devkit/build-angular”。

任何帮助深表感谢。

ionic-framework angular ionic4

9
推荐指数
1
解决办法
6959
查看次数

我的硬件“后退按钮操作”在Ionic 4中不起作用

我正在使用Ionic 4应用程序,当用户在移动后退按钮上单击2次时,它应关闭该应用程序,但这没有发生。

这是我的app.component.ts

lastTimeBackPress = 0;
timePeriodToExit = 2000;
@ViewChildren(IonRouterOutlet) routerOutlets: QueryList<IonRouterOutlet>;

constructor(){
this.backButtonEvent();
}

backButtonEvent() {
    document.addEventListener("backbutton", () => { 
      this.routerOutlets.forEach((outlet: IonRouterOutlet) => {
        if (outlet && outlet.canGoBack()) {
            outlet.pop();
        } else if (this.router.url === '/tabs/tab1') {
          if (new Date().getTime() - this.lastTimeBackPress < this.timePeriodToExit) {
            navigator['app'].exitApp(); //Exit from app
            } else {
            this.presentAlertConfirm();
            this.lastTimeBackPress = new Date().getTime();
          }
          // navigator['app'].exitApp(); // work for ionic 4
        }
      });
    });
  }

  async presentAlertConfirm() {
    const alert = await this.alertController.create({ …
Run Code Online (Sandbox Code Playgroud)

ionic-framework angular ionic4

8
推荐指数
4
解决办法
5074
查看次数

无法找到管道“翻译”错误显示在 Ionic 4 中

我正在使用 Ionic 4 应用程序并安装了该ngx-translate插件。它工作正常,app.component.htmltabs.page.html显示错误。

找不到管道“翻译”

这是我的app.component.html

<ion-list class="mylist22" color="myheader">
    <ion-item color="myheader">
        <ion-label>Gender</ion-label>
        <ion-select [(ngModel)]="languageSelected" (ionChange)='setLanguage()'>
            <ion-select-option value="en" selected>English</ion-select-option>
            <ion-select-option value="ar">Arabic</ion-select-option>
        </ion-select>
    </ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud)

在这个视图中,我有语言选择框。

这是我的app.component.ts

import { TranslateService } from '@ngx-translate/core';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  languageSelected: any = 'en';
  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private translate: TranslateService
  ) {
    this.translate.addLangs(['en', 'ar']);
    this.translate.setDefaultLang('en');
    this.initializeApp();
  }

  initializeApp() {
    this.platform.ready().then(() => { …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ngx-translate angular ionic4

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

我的离子内容与 Ionic 4 中的标题重叠

我正在使用 Ionic 4 应用程序,并且已经安装了 Ionic 4 选项卡主题,并且通过在app.component.html 中添加标题代码使标题通用,但问题是我的标题与标题重叠。

这是我的app.component.html

<ion-header>
    <ion-toolbar>
    <ion-icon name="more" slot="end"></ion-icon>
    </ion-toolbar>
</ion-header>
<ion-app>
    <ion-router-outlet></ion-router-outlet>
</ion-app>
Run Code Online (Sandbox Code Playgroud)

这是我的tab1.page.html

<ion-content>
    <ion-card class="welcome-card">
        <ion-img src="/assets/shapes.svg"></ion-img>
        <ion-card-header>
        <ion-card-subtitle>Get Started</ion-card-subtitle>
        <ion-card-title>Welcome to Ionic</ion-card-title>
        </ion-card-header>
        <ion-card-content>
        <p>Now that your app has been created, you'll want to start building out features and components. Check out some of the resources below for next steps.</p>
        </ion-card-content>
    </ion-card>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

我刚刚在 Ionic 4 中安装了新的标签主题,我只做了这些更改。

在此处输入图片说明

在此处输入图片说明

任何帮助深表感谢。

这是我的StackBlitz

ionic-framework angular ionic4

6
推荐指数
1
解决办法
3730
查看次数

在Ionic Ecommerce App中,当购物车中的产品数量增加时,总价格不会更新

我正在研究Ionic电子商务应用程序并使用Laravel中的API.我已经在购物车中添加了产品,但是当我增加购物车中的产品数量时,产品的价格却在增加,但总价格没有更新,而且当从购物车中取出产品时,它也没有更新价格.

这是我的cart.html:

<ion-header>
  <ion-navbar color="primary">
    <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>
      Your Cart
    </ion-title>
  </ion-navbar>

</ion-header>

<ion-content>
  <ion-list *ngFor="let itm of cartItems" class="myitem11">
    <ion-item>
      <ion-thumbnail item-start >
        <img src="{{itm.image}}">
      </ion-thumbnail>
      <h2>{{itm.name}}</h2>
      <p>Actual Price:
        <span [ngStyle]="itm?.discountp === '0' ? {'text-decoration':'none'} : {'text-decoration':'line-through'}">
          ?{{itm.disprice * itm.count}}
        </span>
      </p>
      <p>Discount: {{itm?.discountp}}%</p>
      <ion-row class="item-count">
        <ion-col class="qty">
            <button (click)="decreaseProductCount(itm)" clear ion-button small color="dark" class="mewbtn11">
              -
            </button>
            <button ion-button small clear color="dark" class="mewbtn11">
              {{itm?.count}}
            </button>
            <button (click)="incrementProductCount(itm)" clear ion-button small color="dark" …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionic3 angular

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

Ionic 应用程序中没有 NavParams 错误的提供程序

我正在将参数从一个组件传输到 app.component.ts 但错误即将到来。错误:没有 NavParams 的提供者。

这是我的app.component.ts

import { FrontPage } from "./../pages/front/front";
import { Component, ViewChild } from "@angular/core";
import { Nav, Platform, NavController, NavParams } from "ionic-angular";
import { StatusBar } from "@ionic-native/status-bar";
import { SplashScreen } from "@ionic-native/splash-screen";
import { HomePage } from "../pages/home/home";
import { ListPage } from "../pages/list/list";
import { ProductPage } from "../pages/product/product";
import { LoginpagePage } from "../pages/loginpage/loginpage";

@Component({
  templateUrl: "app.html",
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;
  menuclick: boolean = …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionic3 angular

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

Not able to align ion-avatar to the center of &lt;ion-item&gt; in Ionic 4

I am working in my Ionic 4 project and I have added the ion-avatar but it is not coming in the center of the

This is my editprofile.page.html:

<ion-item class="newitem2">
    <ion-avatar>
        <img name="profile_pic" [src]="this.userdetailsedit.value.profile_pic"/>
    </ion-avatar>   
</ion-item>
Run Code Online (Sandbox Code Playgroud)

Any help is much appreciated.

ionic-framework ionic4

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

MinDate and MaxDate are not working for the native date picker in Ionic 4

I am working in my Ionic 4 project and I have used the native date picker plugin. It is working fine but I am not able to set the min and max date in it for the Android.

This is my tab2.page.html:

<ion-input formControlName="startchallenge" placeholder="Select Date" (click)="datePickershow()" [readonly]=true></ion-input>
Run Code Online (Sandbox Code Playgroud)

This is my tab2.page.ts:

datePickershow(){
this.datePicker.show({
      date: new Date(),
      mode: 'date',
      androidTheme: this.datePicker.ANDROID_THEMES.THEME_HOLO_DARK,
      minDate: new Date().toISOString(),
      maxDate: new Date(new Date().setDate(new Date().getDate() + 10)).toISOString(),
    }).then(
      date => console.log('Got date: ', date)}, …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionic4

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

如何在Ionic 4中更改工具栏颜色

我在Ionic 4应用程序中工作,我想更改工具栏的背景颜色,但是它不起作用。

我尝试过的

ion-toolbar {
    --background: #f2f2f2;
}

ion-toolbar {
    background: #f2f2f2 !important;
}
Run Code Online (Sandbox Code Playgroud)

喜欢:

颜色:var(-ion-color-contrast);

在哪里定义--ion-color-contrast。在variables.scss文件中或其他用于更改颜色的位置。

任何人都可以帮助我如何variables.scssIonic 4中定义变量以更改颜色。

ionic-framework ionic4

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

标签 统计

ionic-framework ×9

ionic4 ×7

angular ×6

ionic3 ×2

ngx-translate ×1