0

I am using angularJS 1.2.1 and angular-ui-bootstrap

In my code i have list of <ng-includes> from angularjs and <accordion> from angular-ui

But when i load the content i want to make server call and get some values

i solved using this

But now problem is with accordion, I am not able to get all scope variable

the scope outside accordion i am able to get but whatever contents inside accordion its not getting

I think this issue is with loading of accordion . Is there any way to check that accordion contents are loaded? any callback we can write to check accordion contents are loaded?

Community
  • 1
  • 1
  • Can you include the controller code and the template? – David Sung Lee Sep 24 '14 at 14:28
  • 2
    possible duplicate of [How to run function in angular controller on document ready?](http://stackoverflow.com/questions/18646756/how-to-run-function-in-angular-controller-on-document-ready) – andrew Sep 24 '14 at 14:28
  • 1
    possible duplicate of [Angular.js - how to execute function on page load?](http://stackoverflow.com/questions/15458609/angular-js-how-to-execute-function-on-page-load) – Naeem Shaikh Sep 24 '14 at 14:30

1 Answers1

1

there are two approaches to do this.

1)

 // at the bottom of your controller
    var init = function () {
       // check if there is query in url
       // and fire search in case its value is not empty
    };
    // and fire it after definition
    init();

2)

  // register controller in html
    <div data-ng-controller="myCtrl" data-ng-init="init()"></div>

    // in controller
    $scope.init = function () {
        // check if there is query in url
        // and fire search in case its value is not empty
    };

you would find a good answer here How to execute angular controller function on page load? by Dmitry Evseev

Community
  • 1
  • 1
Naeem Shaikh
  • 15,331
  • 6
  • 50
  • 88