Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular Ionic 3-打开应用程序时如何重定向roottab_Angular_Ionic Framework_Ionic3_Viewchild - Fatal编程技术网

Angular Ionic 3-打开应用程序时如何重定向roottab

Angular Ionic 3-打开应用程序时如何重定向roottab,angular,ionic-framework,ionic3,viewchild,Angular,Ionic Framework,Ionic3,Viewchild,我对棱角和离子都是新手,我有一个问题让我很生气。我确信这个解决方案很简单,但我在经过大量搜索和尝试后,没有找到我的解决方案 我用爱奥尼亚3开发了一个应用程序,并使用phonegap推送插件来处理苹果的通知。 我的应用程序使用标签模板,当我收到通知时,我想打开第三个标签,而不是默认的1 我尝试了push方法和setRoot方法,但除了crash之外没有任何附加。 在那之后,为了确保使用正确的方式,我只尝试在第三个选项卡上打开应用程序,但没有更多,只是崩溃。我似乎对@ViewChild有问题 制表符

我对棱角和离子都是新手,我有一个问题让我很生气。我确信这个解决方案很简单,但我在经过大量搜索和尝试后,没有找到我的解决方案

我用爱奥尼亚3开发了一个应用程序,并使用phonegap推送插件来处理苹果的通知。 我的应用程序使用标签模板,当我收到通知时,我想打开第三个标签,而不是默认的1

我尝试了push方法和setRoot方法,但除了crash之外没有任何附加。 在那之后,为了确保使用正确的方式,我只尝试在第三个选项卡上打开应用程序,但没有更多,只是崩溃。我似乎对@ViewChild有问题

制表符

import { SettingsPage } from './../settings/settings';
import { NewsPage } from './../news/news';
import { Component, ViewChild } from '@angular/core';

import { AboutPage } from '../about/about';
import { TableauDeBordPage } from '../tableau-de-bord/tableau-de-bord';
import { HomePage } from '../home/home';
import { Tabs } from '../../../node_modules/ionic-angular/umd';

@Component({
  templateUrl: 'tabs.html'
})
export class TabsPage {

  @ViewChild('myTabs') tabRef: Tabs;

  tab1Root = HomePage;
  tab2Root = TableauDeBordPage;
  tab3Root = NewsPage;
  tab4Root = AboutPage;
  tab5Root = SettingsPage;

  constructor() {
  }

  ionViewDidEnter(){
    this.tabRef.select(2);
  }
}
tabs.html

<ion-tabs #myTabs>
  <ion-tab [root]="tab1Root" tabTitle="Agenda" tabIcon="ios-calendar-outline"></ion-tab>
  <ion-tab [root]="tab2Root" tabTitle="Tableau de bord" tabIcon="ios-speedometer-outline"></ion-tab>
  <ion-tab [root]="tab3Root" tabTitle="News" tabIcon="ios-paper-outline"></ion-tab>
  <ion-tab [root]="tab4Root" tabTitle="Tuiles" tabIcon="ios-grid-outline"></ion-tab>
  <ion-tab [root]="tab5Root" tabTitle="Autre" tabIcon="ios-cog-outline"></ion-tab>
</ion-tabs>

当我从xcode启动应用程序时,我只有崩溃和白色屏幕。 当我从浏览器(ionic serve)启动应用程序时,出现运行时错误:找不到模块“。仅当我使用viewchild时,此追加


我确信我没有以正确的方式使用它,但对我来说,我的做法与爱奥尼亚公司的文档中的做法相同

在app.component.html中

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';

import { TabsPage } from '../pages/tabs/tabs';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage:any = TabsPage;

  constructor(platform: Platform) {
    platform.ready().then(() => {
    });
  }
}

试着这样做:

在app.component.html中

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';

import { TabsPage } from '../pages/tabs/tabs';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage:any = TabsPage;

  constructor(platform: Platform) {
    platform.ready().then(() => {
    });
  }
}

要修复
错误:找不到模块“”

编辑

import{Tabs}来自“../../../node_modules/ionic angular/umd”


从“离子角度”导入{Tabs}

修复
错误:找不到模块“

编辑

import{Tabs}来自“../../../node_modules/ionic angular/umd”


从“离子角度”导入{Tabs}

非常感谢这项工作!使用visual code studio自动导入angular插件时出现的错误。非常感谢您的帮助!使用visual code studio自动导入angular插件时出错。