2016-11-10 2 views
0

Привет Я пытаюсь стрелять событие на повторение сделано в 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

Ваша функция должна быть одна $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(); 
    } 

}); 
+0

Спасибо за ответ , но, к сожалению, предупреждение не работает, даже ничего в консоли –

+0

На самом деле сейчас работает! –

1

Вы Шоуда имеют функцию, как,

$scope.ratingwithng =function() 
{ 
    alert('test'); 
} 
+0

Я пробовал этот путь, но предупреждение не работает –

+0

@SanjeevK вы уверены? – Sajeetharan

+0

Он работал на самом деле –

Смежные вопросы