Quantcast
Channel: Angular2 - should private variables be accessible in the template? - Stack Overflow
Viewing all articles
Browse latest Browse all 9

Angular2 - should private variables be accessible in the template?

$
0
0

If a variable is declared private on a component class, should I be able to access it in the template of that component?

@Component({  selector: 'my-app',  template: `<div><h2>{{title}}</h2><h2>Hello {{userName}}</h2> // I am getting this name</div>  `,})export class App {  public title = 'Angular 2';  private userName = "Test Name"; //declared as private}

Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles



Latest Images