Issue
It shows an error with the template,
Errors:
- Property 'result' is private and only accessible within class 'upperCaseComponent'
- Property 'mymessage' is not declared in 'upperCaseComponent'
my html
<input type="text" [(ngModel)]="mymessage"
<button (click)="clickMe()"> send</button>
<br><br>
<h1>{{result | json}}</h1>
my component.ts
import {Component} from "@angular/core";
export class MyComponent {
private result: any;
constructor()
}
Solution
So here the error say it not able to find variable 'mymessage' in uppercase.component.ts
export class UpperCaseComponent {
public results: any; // Change it private to public
public mymessage: any;
}
If you are trying to access variable within template you need to declare it as public as if you declare it as private it would be accessible only within class
Answered By - mayur
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.