打字稿编译器错误预期分号与 Angular 1.5 组件
Typescript compiler error expected semi-colon with Angular 1.5 component
我在尝试编译以下 Angular 组件时从 TypeScript 收到预期的分号错误。
我觉得没问题,但只有在我添加 this.$routeConfig
数组时才会抛出错误:
export class AppComponent implements ng.IComponentOptions {
public template: string;
public $routeConfig: Array<any>;
constructor(){
this.template = `<h1>Home</h1>
<ng-outlet></ng-outlet>`;
this.$routeConfig: [{
path: '/',
component: 'loginComponent',
name: 'Login',
useAsDefault: true
}];
}
}
刚刚意识到我的 'school boy' 错误!
应该是this.$routeConfig = [];
我在尝试编译以下 Angular 组件时从 TypeScript 收到预期的分号错误。
我觉得没问题,但只有在我添加 this.$routeConfig
数组时才会抛出错误:
export class AppComponent implements ng.IComponentOptions {
public template: string;
public $routeConfig: Array<any>;
constructor(){
this.template = `<h1>Home</h1>
<ng-outlet></ng-outlet>`;
this.$routeConfig: [{
path: '/',
component: 'loginComponent',
name: 'Login',
useAsDefault: true
}];
}
}
刚刚意识到我的 'school boy' 错误!
应该是this.$routeConfig = [];