Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait to render until a child element is defined #94

Open
mikcox opened this issue Jul 29, 2014 · 1 comment
Open

Wait to render until a child element is defined #94

mikcox opened this issue Jul 29, 2014 · 1 comment

Comments

@mikcox
Copy link

mikcox commented Jul 29, 2014

Hello,

I'm trying to place a highcharts directive (highcharts-ng) inside of an ng-repeat, and then destroy any of ng-repeat's watchers on the data series of the chart. To do this, I create a highchartConfig object on the scope, which is passed to the highcharts-ng directive (though it doesn't yet have any data in it), and I'm putting a bindonce attribute on that config object that's being given to the highcharts-ng directive. The problem is that bindonce tries to render the highchart at the instant that the highchartConfig object exists (when it's still waiting on data), and then won't update again once I've gotten my data back and added it to the highchartConfig object.

My basic workflow is that I want to:

  1. create the highchartConfig object
  2. pass the config object to the highcharts-ng directive
  3. assign the data array to the highcharts config object
  4. update the dom
  5. destroy all watchers on the highchartsConfig object.

I know that the high level bindonce directive will wait on a given object to become defined before rendering that object's children, but is it possible to also have it wait on a given child object to be defined before rendering the div with a passed parent as an attribute?

For instance:

<div bindonce="highchartConfig.series.data">
    <highchart bo-attr bo-attr-config="highchartConfig"></highchart>
</div>

Could we wait to render the highchart element until highchartConfig.series.data is defined?

Cheers!

@Pasvaz
Copy link
Owner

Pasvaz commented Sep 19, 2014

I'm not sure to understand, but in theory inside the bindonce attribute you can use an expression which get defined when all your objects are defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants