找不到模块“@ angular / core / src / metadata / directives”

时间:2018-01-21 16:41:17

标签: angularjs angular ionic-framework ionic2

尝试查看Ionic2应用程序时出现此错误。我试图在我的应用程序中实现天气应用程序。我不确定这是否导致错误。

我不确定错误来自哪里,所以我不确定要发布哪些代码,所以,如果您需要查看某些代码,请告诉我。

找不到模块“@ angular / core / src / metadata / directives”

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import firebase from 'firebase';
import { firebaseConfig } from './credentials';
import { HomePage } from '../pages/home/home';
import { Unsubscribe } from '@firebase/util';
import {MenuPage} from '../pages/menu/menu';

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

  constructor(
    platform: Platform,
    statusBar: StatusBar,
    splashScreen: SplashScreen
  ) {
    firebase.initializeApp(firebaseConfig);

    const unsubscribe: Unsubscribe = firebase.auth().onAuthStateChanged(user => {
      if (user) {
        this.rootPage = HomePage;
        unsubscribe();
      } else {
        this.rootPage = 'LoginPage';
        unsubscribe();
      }
    });

    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();
    });
  }
}

2 个答案:

答案 0 :(得分:7)

Deep imports 不支持我在上面的评论中提到,更改

发件人

import {Input} from '@angular/core/src/metadata/directives';

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

答案 1 :(得分:0)

将导入更改为:

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

然后重新启动应用程序。