Property ‘hero’ does not exist on type ‘HeroesComponent’.
hero = ‘Windstorm’; 不要写在ts文件的最下面,应该写在export里面
下面展示一些 内联代码片
。
// A code block
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-heroes',
templateUrl: './heroes.component.html',
styleUrls: ['./heroes.component.less']
})
export class HeroesComponent implements OnInit {
hero = 'Windstorm';
constructor() { }
ngOnInit(): void {
}
}
;
// An highlighted block
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-heroes',
templateUrl: './heroes.component.html',
styleUrls: ['./heroes.component.less']
})
export class HeroesComponent implements OnInit {
hero = 'Windstorm';
constructor() { }
ngOnInit(): void {
}
}
;
菜鸟刚学前端,欢迎指教~~