Is it possible to access a global variable from an angular template?
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;
}
}
Then in template HTML:
<section>
//Can't read this variable
{{ cantAccess }}
</section>
Is it possible to get 'cantAccess' to appear true in the template?