Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularJS ng-click not invoked where dom inside repeat
    text
    copied!<p>When the ng-repeat area in my code example is executed the ng-click actions are not working. Although if moved outside the ng-repeat it would work. Which am not sure how to solve or what is causing this to happen, </p> <p>my HTML</p> <pre><code>&lt;table class="table table-bordered table-hover" id="my-vehicles-table" ng-controller="VehicleController"&gt; &lt;tbody&gt; &lt;tr ng-repeat="car in cars"&gt; &lt;td&gt;&lt;a href="{% ng car.get_absolute_url %}"&gt;{% ng car._get_model_display.make_display %} {% ng car._get_model_display.model_display %} {% ng car._get_model_display.trim_display %}&lt;/a&gt;&lt;/td&gt; &lt;td&gt;{% ng car.created_since %}&lt;/td&gt; &lt;td&gt;{% ng car.view_count %}&lt;/td&gt; &lt;td&gt; &lt;a href="#" ng-click="delete($event, {% ng car.id %})" class="btn btn-danger btn-mini delete-btn"&gt;{% trans 'Delete' %}&lt;/a&gt; &lt;a href="#" ng-model="edit" class="btn btn-primary btn-mini edit-btn"&gt;{% trans 'Edit' %}&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>where by {% ng xxx %} will output {{ xx }} this is the django template tag for it. The content is rendered normally, even inside the anchor for delete, I can see delete($event, num) so its populating the values correctly. </p> <p>But when I click the delete anchor its not invoking the function delete from my following controller </p> <pre><code>'use strict'; function VehicleController($scope, car) { car.query( // params {created_by: '1'}, // success function(data) { $scope.cars = data.objects; }, // error function(data) { } ); var init = function() { }; $scope.delete = function($event) { console.log('dude'); // car.delete({id: id}); } // initialize values init(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload