所有 Angular 个项目都存在与 component.ts 相同的问题
All Angular projects have the same problem with component.ts
一直在 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>
请从 @angular/common
导入 CommonModule
。您正在使用由 CommonModule
.
提供的 uppercase
一直在 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>
请从 @angular/common
导入 CommonModule
。您正在使用由 CommonModule
.
uppercase