我想输出一个格式化的名称字符串与姓氏粗体字体.就像这样:
LASTNAME,名字
在Angular中,我通常会在HTML模板中这样做:
<strong>{{ lastname | uppercase }}</strong>, {{ firstname }}
但由于有strong
个标签,它会自动在标签后面插入一个"空格",结果是:
LASTNAME,名字
那么我如何才能防止额外的space
打印在HTML模板中呢?
我想输出一个格式化的名称字符串与姓氏粗体字体.就像这样:
LASTNAME,名字
在Angular中,我通常会在HTML模板中这样做:
<strong>{{ lastname | uppercase }}</strong>, {{ firstname }}
但由于有strong
个标签,它会自动在标签后面插入一个"空格",结果是:
LASTNAME,名字
那么我如何才能防止额外的space
打印在HTML模板中呢?
实际上,我无法复制的问题,请找到下面的CSS摆脱任何额外的空间.如果没有,请与复制的问题共享stackblitz,您需要判断该特定strong
标记上的元素并判断计算选项卡,其中添加了额外的空间
HTML
<div>
<strong>{{ lastname | uppercase }}</strong>
<span>, {{ firstname }}</span>
</div>
ts
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import 'zone.js';
@Component({
selector: 'app-root',
imports: [CommonModule],
templateUrl: './main.HTML',
standalone: true,
})
export class App {
name = 'Angular';
lastname = 'Lastname';
firstname = 'Firstname';
}
bootstrapApplication(App);