2016-03-24 19 views
3

私はrootページがAuthPageに設定されたIonic 2プロジェクトに取り組んでいます。後でSplashPageという名前の別のページを作成しましたが、スプラッシュページにrootPageを設定するとエラーUncaught Error: Cannot find module "./pages/splash/splash"(app.bundle.js:3188)が表示されました。何が間違っているのか?それはapp.tsようにあなたは、クラスspalshを呼んでいるが、実際のクラス名がSplashPageの名前を変更し、SplashPage未知のエラー:モジュールが見つかりません - イオン2

そうしようとしているに見えます

app.ts

import {App, IonicApp, Platform} from 'ionic-angular'; 
import {ListPage} from './pages/list/list'; 
import {WishListPage} from './pages/wishlist/wishlist'; 
import {AuthPage} from './pages/auth/auth'; 
import {SplashPage} from './pages/splash/splash'; 

@App({ 
    templateUrl: 'build/app.html', 
    config: {}, // http://ionicframework.com/docs/v2/api/config/Config/ 
    providers: [UserService] 
}) 
class MyApp { 
    rootPage: any = SplashPage; 
    pages: Array<{title: string, component: any, user: string}>; 
    user: any; 
    constructor(private app: IonicApp, private platform: Platform, 
       private userService: UserService) { 
     this.initializeApp(); 
     this.user = userService; 

     // used for an example of ngFor and navigation 
     this.pages = [ 

      // No need to include this since the user shouldn't see 
      // the login page again until their session/token expires 
      //{ title: 'Login', component: AuthPage }, 

      // Since we don't need to fear our user manually navigating 
      // via url, why not manage naviagtion permissions with simple 
      // template conditionals `*ngIf` 
      { title: 'Wishlist', component: WishListPage, user: "shopper"}, // SHOPPER 
      { title: 'Current Orders', component: ListPage, user: "shopper" }, // SHOPPER 
      { title: 'Orders', component: ListPage, user: "boxer" }, // BOXER 
      { title: 'Profile', component: ProfilePage, user:"both" } // BOTH 
     ]; 

    } 

splash.ts

import {OnInit} from 'angular2/core'; 
import {NgIf} from 'angular2/common'; 
import {Page, NavController} from 'ionic-angular'; 

// @PAGES 
import {AuthPage} from '../auth/auth'; 

@Page({ 
    templateUrl: 'build/pages/splash/splash.html', 
    directives: [NgIf], 
    providers: [] 
}) 

export class SplashPage { 
    constructor() { console.log("@AuthPage: __init__"); } 
} 
+0

あなたはそれを見つけましたか?同じエラーがあります。 –

+0

@AlejandroLoraはまだありません:/ –

+0

それは役に立たないかもしれませんが、 '@Page'デコレータの代わりに '@Component'デコレータを試してみてください。 –

答えて

-2

#splash.tsのSplash

+0

私はそれが問題だと思います。さもなければ、私はクラスAuthPageをAuthに、WishListPageをWishListに変更しなければなりませんでした(両方ともうまくいきます)。 Btw、SplashPageは 'ionic g page splash'コマンドで自動作成されました –