在YouTube上观看了一些Angular 7项目视频后,却被试图将名称从component.ts
传递到component.html
的基本阶段所迷住。
当前输出和当前代码为"Hello"
减去名称-没有错误消息。
APP.COMPONENT.TS:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
name:string = 'Brad';
}
APP.COMPONENT.HTML:
<div>
<h1>Hello {{ name | uppercase }} </h1>
{{ 1 + 1 }}
</div>
答案 0 :(得分:2)
请从CommonModule
导入@angular/common
。您正在使用uppercase
提供的CommonModule
。