dongx dongx - 1 year ago 111
AngularJS Question

How to access Angular 2 object's attribute

export class Dashboard {
checked: Object = {users: false, device: false}
console.log("clicked users");

Property 'users' does not exist on type 'Object'. Why?

Answer Source

You are saying checked: Object = {users: false, device: false} which means that only those members defined 'Object' (the interface) will be visible. So you can not just access 'users'.

You should say checked: any = {users: false, device: false}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download