在sailsjs中多次执行GET函数调用

时间:2016-07-19 19:27:22

标签: sails.js

enter image description here

一切都很好,在angular的控制器和风帆控制器中,在route.js中,为什么我的这个呼叫一次又一次?

sample.controller('PatientEprescriptionController',function($scope,$http,$log, $modal){



   $http.get('/patientEprescription')

         .success(function(data){
            //On successful API CALL check whether empty data is returned or not
            if(data.notFound === true)
            {
                //If employee not Found set error flag -- ng-show manages the rest 
                $scope.notFound = true;
                return;
            }
            //if employee found copy employee Data
            $scope.prescription = data.doctorData;
            //Log the data
           // $log.info(data);
         })
         .error(function(data){
            //Log error Data
            $log.info(data);
         });





var params= {

                        medicine: [$rootScope.medicinedrop],
                        days:[$rootScope.daydrop],
                        dosage:[$rootScope.dosedrop],
                       // salt:$scope.list5,
                        path:[$rootScope.testdrop],
                        patientid:$scope.user.patientID,
                        prescriptionid:$scope.uniqID,
                        date:$scope.edate,
                        chiefcomplaint:$scope.user.chiefcomplaint,
                        symptom:$scope.user.symptom,
                        diagnosis:$scope.user.examination,
                        treatmentplan:$scope.user.treatment,
                        treatmentcast:$scope.user.treatmentcost,
                        treatmentstatus:$scope.user.status
                        };

                     $http.post('/patientprescription', params).success(function(){
                        console.log("Success!", params);

                    }).error(function(err) {
                   console.log("Error!", err);
                     });

               },



 <table class="table table-striped table-bordered table-hover table-condensed">
       <tr>
        <th>Patientid</th>
        <th>Chief Complaint</th> 
        <th>Date</th>
        <th></th>  
         <th></th>
          <th></th>
      </tr>
     <tr ng-repeat="value in prescription |filter: searchKey">
         <td><button class="btn btn-default" ng-click="open(value)" value="{{ value.patientid }}">{{ value.patientid }}</td>
        <td>{{value.chiefcomplaint}}</td>
        <td>{{value.date}}</td>

    </tr>
      </table>

'GET / patientEprescription':'PatientprescriptionController.getpatientprescription',

'POST / patientprescription':'PatientprescriptionController.patientprescriptions',

这是我的代码,我在这里添加了我的角度和风帆控制器,还添加了我的ejs文件..

0 个答案:

没有答案