I'm new to Angular. I want to ask about @Input("data") detailData = {}; in angular. When I console.log(detailData) it come out data like this.
Object { category: "dictionary", entityCategory: null, iconName: "dictionaryD", detail: {…}, key: "dictionary-7" }
And When I click button in console.log(detailData) it display like this
Object { category: "dictionary", entityCategory: null, iconName: "dictionaryD", detail: {…}, key: "dictionary-7", selected: true }
It mean, when I click button it add selected: true but when I console.log(detailData.selected) it come out
error TS2339: Property 'selected' does not exist on type '{}'.
What whould I do to make it work when I console.log(detailData.selected) it not come out error.
Add Component Code
export class ResultDetailsComponent implements OnInit {
@Input("data") detailData = {};
@Output() expand = new EventEmitter();
private expanded = false;
constructor() {}
// console.log(this.detailData)
ngOnInit() {
console.log(this.detailData)}
if (detailData) {
detailData.scrollIntoView()
}
}
Note:
But in HTML page when I {{detailData.selected}} it come out True
Hope you all can help me.
@Input() detaiData : anywhen console.log it come outundefined- Pravu