Mika Mika - 1 year ago 129
AngularJS Question

Wait for data to load before instantiating a component

I am using Angular 1.5. I have a component embedded in another component as demonstrated below. Problem is that the

variable is not yet resolved when angular fires
and so I get nothing. How do I wait for the variable to be resolved before the child component instantiates.


<component-child data="$ctrl.data._id"><\component-child>


this.data = SomeResource.get();

Answer Source

How about using ng-if?

     <component-child ng-if="$ctrl.data._id" data="$ctrl.data._id"> </component-child>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download