How to execute AngularJS controller function on page load?

前端 未结 14 2353
一整个雨季
一整个雨季 2020-11-22 16:04

Currently I have an Angular.js page that allows searching and displays results. User clicks on a search result, then clicks back button. I want the search results to be disp

14条回答
  •  逝去的感伤
    2020-11-22 16:25

    I had the same problem and only this solution worked for me (it runs a function after a complete DOM has been loaded). I use this for scroll to anchor after page has been loaded:

    angular.element(window.document.body).ready(function () {
    
                            // Your function that runs after all DOM is loaded
    
                        });
    

提交回复
热议问题