所有Angular项目的component.ts都有相同的问题

时间:2019-07-04 13:38:21

标签: angular typescript angular7

在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>

1 个答案:

答案 0 :(得分:2)

请从CommonModule导入@angular/common。您正在使用uppercase提供的CommonModule