意外的标记。使用离子框架运行时显示的构造函数,方法,访问器或属性预期错误

时间:2017-10-13 05:27:10

标签: ionic2

我正在关注教程中的示例代码,在该项目中,我尝试添加页面并在页面中导航,但我在app.component.ts文件中出现此错误,因为其他页面运行良好,我可以弄清楚发生的错误。请帮我摆脱这个!不胜感激 代码贴在下面:

import { Component, ViewChild } from '@angular/core';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { TranslateService } from '@ngx-translate/core';
import { Config, Nav, Platform } from 'ionic-angular';
import { FirstRunPage } from '../pages/pages';
import { Settings } from '../providers/providers';
@Component({
template: `<ion-menu [content]="content">
<ion-header>
  <ion-toolbar>
    <ion-title>Pages</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-list>
    <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
      {{p.title}}
    </button>
  </ion-list>
</ion-content>

</ion-menu>
<ion-nav #content [root]="rootPage"></ion-nav>`
})
export class MyApp {
rootPage = FirstRunPage;

@ViewChild(Nav) nav: Nav;

pages: any[] = [
{ title: 'Tutorial', component: 'TutorialPage' },
{ title: 'Welcome', component: 'WelcomePage' },
{ title: 'Toast', component: 'ToastPage' },
{ title: 'Tabs', component: 'TabsPage' },
{ title: 'Cards', component: 'CardsPage' },
{ title: 'Content', component: 'ContentPage' },
{ title: 'Login', component: 'LoginPage' },
{ title: 'Signup', component: 'SignupPage' },
{ title: 'Master Detail', component: 'ListMasterPage' },
{ title: 'Menu', component: 'MenuPage' },
{ title: 'Settings', component: 'SettingsPage' },
{ title: 'Search', component: 'SearchPage' }
]

 constructor(private translate: TranslateService, platform:Platform,
 settings: Settings,
 private config: Config, 
 private statusBar: StatusBar,      private splashScreen: SplashScreen) {
   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.
  this.statusBar.styleDefault();
  this.splashScreen.hide();
  });
  this.initTranslate();

  }


initTranslate() {

this.translate.setDefaultLang('en');

if (this.translate.getBrowserLang() !== undefined) {
  this.translate.use(this.translate.getBrowserLang());
} else {
  this.translate.use('en'); // Set your language here
}

this.translate.get(['BACK_BUTTON_TEXT']).subscribe(values => {
});

}

this.app.get(page.component);
}
}

0 个答案:

没有答案