Angular2, TypeScript, How to read/bind attribute value to component class (undefined in ngOnInit) [duplicate]
问题 This question already has answers here : Angular 2 external inputs (4 answers) Closed 3 years ago . can someone please advice me how to read/bind attribute value to @component class, which seems to be undefined in ngOnInit method? Here's a plunker demo: http://plnkr.co/edit/4FoFNBFsOEvvOkyfn0lw?p=preview I'd like to read value of "someattribute" attribute <my-app [someattribute]="'somevalue'"> inside the App class (src/app.ts) ngOninit method. Thanks! 回答1: You can notice that such parameters