Click here to Skip to main content
14,665,301 members
Rate this:
Please Sign up or sign in to vote.
See more:
import { Component } from '@angular/core';
@Component({
  selector: 'app-root',
  template: `
  <p>Alive!</p>
  <app-vp-root></app-vp-root>`,
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  someVariable: someType = somevalue 
  someFunction(){
     console.log(this.someVariable)
  }


 ***//can i access through other than this.someVariable line AppComponent.someVariable;***


}


What I have tried:

sometimes there may be situation like using bootbox function in which 'this' does not refers to 'AppComponent' so one must use 'es arrow' function to achieve this so is there any way other than this
Posted
Updated 22-Sep-20 5:56am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100