I have simple app, display file list from server- upload file- dispay updated list. I have two controllers "upload" and "files" under different div's.
I want to be able to call loadData() from files so that my file list gets updated after upload.
UPDATED DOCE
app.controller('myCtrl1',
    function ($scope,$http) {
$scope.fileupload=function()
{
$scope.loadData();
}
//load file list
$scope.loadData = function () {
$scope.fileslist = ["abc.abc", "cde.cde"];
}
});
HTML UPDATED
 <body ng-app="myapp" nng-controller="myCtrl1">
 <div>
        <div>
        <form id="upload-form" method="post" action="">
            <input type="file" name="file"/>
            <input type="submit" value="upload" class="button" ng-click="loadData()"/>
        </form>
        </div>
</div>
<div>
<div>
<form name="myForm">
    <ul>
        <li ng-repeat="fileslist in fileslist">
            <label>
                <input type="radio" ng-model="$parent.name" name="name" value="{{fileslist}}" required />{{fileslist}}
            </label>
        </li>
    </ul>
    <button ng-disabled="myForm.$invalid" class="button">Submit</button>
I just want to run "loadData()" function of myCtrl1 controller when I click on button in upload controller
UPDATED problem - I did a code change and merged the controller, as service was not going help me refresh controller
So Now the problem is I can load the requred data why loadData() but it disappears in a second...
 
     
     
     
    