ng-click not firing in AngularJS while onclick does

前端 未结 7 564
余生分开走
余生分开走 2020-12-15 04:56

I am trying to use AngularJS in my application and have been successful to some extent.

I am able to fetch data and display it to the user. And I have a button in

相关标签:
7条回答
  • 2020-12-15 05:50

    As mentioned, the function should be created inside the scope:

     $scope.deleteRecord = function (docURL) {
             console.log(docURL);
    
             $http.delete(docURL);
    }
    

    To use the function, first drop the "{{ }}" since you are using it from inside an ng-repeat. Another issue is the use of apostrophe in your code, you have two pairs one inside the other... well I am sure you get the problem with that.

    Use the function like so:

    ng-click="deleteRecord(d['@link'].href)"
    

    Best of luck !

    0 讨论(0)
提交回复
热议问题