Quantcast
Viewing latest article 9
Browse Latest Browse All 9

Angular2 - should private variables be accessible in the template?

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 latest article 9
Browse Latest Browse All 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>