在AngularJS中重复完成的火灾事件

时间:2016-11-10 06:45:18

标签: javascript jquery angularjs

您好我正在尝试在AngularJS中重复完成事件,以下是代码:

以下是HTML代码

<li ng-repeat="y in names | limitTo: 6" repeat-done="ratingwithng()"> <a href="<?php echo $this->config->item('search_url');?>{{y.hosurl}}">
  <div class="hospital-card"> <img src="{{y.profile_image}}" width="" height="" />
    <h3 class="vlcc-name">{{y.clinic_name}}</h3>
    <div class="doc-rete">
      <div id="rateYo-hos" class="mc-doc-rating">3</div>
    </div>
    <p class="hospital-specialist">{{y.localty }} {{y.city }}</p>
    <p class="vlcc-experince">{{y.clinic_type }}</p>
    <p class="vlcc-address">{{y.hos_time }} </p>
  </div>
  </a>
</li>

以下是AngularJS代码:

var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {   
   $http.get("frontendapi/hospital_list")
   .then(function (response) {$scope.names = response.data.HospitalList;});  

    $http.get("frontendapi/NewsList")
   .then(function (response) {$scope.namesNews = response.data.Newslistfeature;});

   $http.get("frontendapi/NewsList")
   .then(function (response) {$scope.namesNewsRec = response.data.Newslist;});

   $http.get("frontendapi/NewsList")
   .then(function (response) {$scope.nameDoctor = response.data.records;});

   $http.get("frontendapi/people_list")
   .then(function (response) {$scope.nameDoctorShift = response.data.PeopleList;});

   $http.get("frontendapi/interviews_list")
   .then(function (response) {$scope.nameInterview = response.data.interviewslist;});

});
function ratingwithng()
{
    alert();
}

警报无效,请建议。

感谢

2 个答案:

答案 0 :(得分:2)

您的函数必须是$scope对象的ng-repeat对象才能在var app = angular.module('myApp', []); app.controller('customersCtrl', function($scope, $http) { $http.get("frontendapi/hospital_list") .then(function (response) {$scope.names = response.data.HospitalList;}); $http.get("frontendapi/NewsList") .then(function (response) {$scope.namesNews = response.data.Newslistfeature;}); $http.get("frontendapi/NewsList") .then(function (response) {$scope.namesNewsRec = response.data.Newslist;}); $http.get("frontendapi/NewsList") .then(function (response) {$scope.nameDoctor = response.data.records;}); $http.get("frontendapi/people_list") .then(function (response) {$scope.nameDoctorShift = response.data.PeopleList;}); $http.get("frontendapi/interviews_list") .then(function (response) {$scope.nameInterview = response.data.interviewslist;}); $scope.ratingwithng = function () { alert(); } }); 上显示

meters *= variable1;
centimeters *= variable2;

答案 1 :(得分:1)

你的功能是,

{{1}}