Angularjs on page load call function

后端 未结 7 481
臣服心动
臣服心动 2021-01-14 10:09

I am learning AngularJS. I have some article tag and on clicking on a button each article page is showed without any page refresh. This is one page website. Wha

7条回答
  •  失恋的感觉
    2021-01-14 10:40

    you can use it directly with $scope instance

         $scope.init=function()
            {
                console.log("entered");
                data={};
                /*do whatever you want such as initialising scope variable,
                  using $http instance etcc..*/
            }
           //simple call init function on controller
           $scope.init();
    

提交回复
热议问题