How to resolve error self.parentView.context is undefined?

1.3K    Asked by TraceyMacLeod in Python , Asked on Jan 31, 2020
Answered by Tracey MacLeod


   

       

        {{nrPanier}}

   

    déconnexion

    mon compte

    professionnels


If we execute the above code it will throw an error as self.parentView.context is undefined.

As this error indicates, utilisateur.role is not defined by the time we execute your *ngIf hence utilisateur.role.lowerCase() is throwing an error. We can do a workaround like this:

*ngIf="utilisateur.role && utilisateur.role.toLowerCase()=='parent'">


This will first check for utilisateur.role and if it is undefined, it will be evaluated to false



Your Answer

Interviews

Parent Categories