Можно ли получить доступ к глобальной переменной из шаблона angular?
let cantAccess = false;
@Component({
selector: 'app-payment',
templateUrl: './buy.component.html',
styleUrls: ['./buy.component.scss']
})
export class BuyComponent implements OnInit, AfterViewInit {
constructor() {
}
ngOnInit() {
cantAccess = false;
}
}
Затем в шаблоне HTML:
<section>
//Can't read this variable
{{ cantAccess }}
</section>
Можно ли получить 'cantAccess? 'чтобы быть верным в шаблоне?