Clickable bootstrap row with angular

前端 未结 4 1096
忘了有多久
忘了有多久 2021-02-13 12:20

I have got a table, styled with bootstrap. The content of this table is filled using Angular.js. How do I make a row clickable so it will call a function in the scope?

T

4条回答
  •  半阙折子戏
    2021-02-13 12:39

    You could just pass the ingredient in argument

    ng-click="setSelected(ingredient)"

    and in controller

       $scope.setSelected = function(my_ingredient) {
           $scope.selected = my_ingredient;
           console.log($scope.selected);
       };
    

提交回复
热议问题