我想声明一个像public const SHIPMENT_MENU_ITEM='SHIPMENT';
这样的常量变量,并通过引用const变量在我的html中使用。但是我做不到。我在这里想念的。
import { Component } from '@angular/core';
@Component({
selector: 'app-header-bar',
templateUrl: './header-bar.component.html',
styleUrls: ['./header-bar.component.scss']
})
export class HeaderBarComponent {
activeLink: String = 'SHIPMENT';
constructor() {
}
onSelectNav(option) {
this.activeLink = option;
}
}
答案 0 :(得分:0)
import { Component } from '@angular/core';
@Component({
selector: 'app-header-bar',
templateUrl: './header-bar.component.html',
styleUrls: ['./header-bar.component.scss']
})
export class HeaderBarComponent {
public SHIPMENT_MENU_ITEM: String= SHIPMENT';
activeLink: String = 'SHIPMENT';
constructor() {
}
onSelectNav(option) {
this.activeLink = option;
}
}