Is there a way to access a global variable from an Angular template?
let unableToAccess = false;
@Component({
selector: 'app-payment',
templateUrl: './buy.component.html',
styleUrls: ['./buy.component.scss']
})
export class BuyComponent implements OnInit, AfterViewInit {
constructor() {
}
ngOnInit() {
unableToAccess = false;
}
}
Later in the HTML template:
<section>
//This variable cannot be accessed
{{ unableToAccess }}
</section>
Is there any way to display 'unableToAccess' as true in the template?