angular - angular2: The hierarchic Json data cannot displayed correctly -


i test angular2-seed (https://github.com/angular/angular2-seed) displaying repo-detail, pure json string, in table. appending following code in repo-detail.component.html:

<table>     <tr>         <td>{{repodetails.id}}</td>         <td>{{repodetails.owner.login}}</td> <!--it's ok without line-->     </tr> </table> 

now data not correctly displayed. in console, got:

zone.js:388 unhandled promise rejection: error in ./repodetailcomponent class repodetailcomponent - inline template:7:12 caused by:  cannot read property 'login' of undefined ; zone: angular ; task: promise.then ; value: viewwrappederror {_nativeerror: error: error in ./repodetailcomponent class repodetailcomponent - inline template:7:12 caused by: ca…, originalerror: typeerror: cannot read property 'login' of undefined     @ debugappview._view_repodetailcomponent0.…, context: debugcontext} typeerror: cannot read property 'login' of undefined     @ debugappview._view_repodetailcomponent0.detectchangesinternal (/appmodule/repodetailcomponent/component.ngfactory.js:108:72)     @ debugappview.appview.detectchanges  

...

try adding

<table>     <tr *ngif="repodetails">         <td>{{repodetails.id}}</td>         <td *ngif="repodetails.owner">{{repodetails.owner.login}}</td> <!--it's ok without line-->     </tr> </table> 

what doing here rendering template when repodetails.owner available.


Comments

Popular posts from this blog

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -

php - Autoloader issue not returning Class -