I'm new to Angular 6. I'm not getting how to access Json object values in view using key.
I'm making http.get(url) in my service and I'm calling that method in my component
export class CustomersComponent implements OnInit {
constructor(private accounts: AccountService) { }
account: Object;
ngOnInit() {
this.accounts.getAccountById(1).subscribe((data)=> {
this.account = data ;
}
);}}
The returned data is a json object is like this
{
"accountId": 1,
"attributeCode": "2300000000",
"attributeLabel": "Customer Status"
}
How to access the values inside this json object in view?
I have tried using
{{account.accountId}}
getting error in console as accountId undefined
{{account | json}}
This is working fine, it is printing everything but I would like to use the values inside this object at different places in my view.