I am new in Angular 2. I have an object attributes which it is an instance of Map
I want to access to its value.
InputFirstComponent
export class InputFirstComponent implements OnInit {
@Input() public inputFirstToDisplay: CustomInput;
constructor() { }
ngOnInit() {
console.log('InputFirstComponent: onInit');
console.log(this.inputFirstToDisplay);
console.log('attribute Object which i want to acces to its attribute')
console.log( this.inputFirstToDisplay.attributes);
}
}
I tried
console.log( this.inputFirstToDisplay.attributes.get('minOccurs'));
console.log( this.inputFirstToDisplay.attributes['minOccurs'].value); //
print undefined
the object inputFirstToDisplay of CustomInput class:
export class CustomInput {
constructor(public name: string, public text: string, public defaultText:
string,
public complexType: boolean, public type: string, public children:
CustomInput[] = [],
public isMultiValued: boolean,
public values: string[] = [], public indicator: string, public
required: boolean,
public isSelected: boolean, public
simpleTypeVarietyOrComplexTypeContent: number,
public choiceContent: boolean, public inputQname: string,
public attributes: Map<string, string> = new Map<string, string>()
) {}
}
attributes: Map(String, string) is an attribute of the custom input class and it which I want to access to its value.
Thanks