Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't need a second controller to do this (MyCtrl3).</p> <p>Change your link to:</p> <pre><code>&lt;a ng-click="deletedownload(item.downloadID)"&gt;Delete&lt;/a&gt; </code></pre> <p>and add this function to the $scope that this view binds to (the $scope that has the "items" list):</p> <pre><code>$scope.deletedownload = function(downloadID) { $http({ method : 'DELETE', url : '/view1/downloaddelete', data : downloadID }); } </code></pre> <p>Small tutorial:<br/> Your view is associated with a specific $scope which you manipulate from the controller code. There, you define your "items" list and "deletedownload" function. For each item in the list, ng-repeat creates a new $scope that prototypally inherits from the parent $scope (the one mentioned before) all it's properties, plus it defines a new property called "item" which is one item from the list at the time. <br/> <br/> When you write:</p> <pre><code>ng-click="deletedownload(item.downloadID)" </code></pre> <p>you essentially define a kind of "expression" which evaluates against the associated $scope. This means that the variables you can refer to (the lexical scope) must be properties of the $scope that the anchor DOM element is associated with. Since the anchor element is a child of the list item element, it is associated with the $scope created there. This $scope has a "deletedownload" member inherited from it's parent $scope and an "item" member created by ng-repeat. <br/> <br/> I suggest you use Firefox with <a href="https://addons.mozilla.org/en-US/firefox/addon/firebug/" rel="nofollow">Firebug</a> + <a href="https://addons.mozilla.org/en-US/firefox/addon/angscope-simple-angularjs-s/" rel="nofollow">AngScope</a> (a tiny extension i wrote) to inspect $scopes behind DOM elements. You should also verify that HTTP calls to you backend contain the correct data. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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