0

I tried to call a component from another component as

<c:NewStudentMaster TeacherId="{!v.teacher.Id}"/>

Here for the first time I am getting value of Teacher.Id as null in controller but when I am trying to call it on some event on another component it is running properly with corresponding TeacherId. Even it is able to print same value for first time on component but not able to fetch this in controller. I am not getting why it is sending null value for the very first time. If I run above component individually from lightning app it is working fine.

1

Just to be clear - this TeacherId data is coming from inside the component and binding back up to a variable in the View?

If you are trying to access it during the init method of the parent component, then it will see null because it's running before the component actually initializes.

I will also point out that for the moment there are some bugs around binding to object properties if Lightning Locker is enabled. Hopefully to be fixed soon.

  • Yes correct componet will load first after that init method im not wrong? – SFDC FAN Feb 25 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.