MD list with more than one MD secondary action

In my list of objects, I can activate / inactive the object. So, the icon activates the action, and the other makes an inactive action, and both are in the same one md-list.

This is what I do

the code:

<md-list ng-app="MyApp" class="listdemoListControls" ng-controller="ListCtrl">
  <md-list-item ng-repeat="message in messages" ng-click='actionOne("action one")'>
    <p>{{message.title}}</p>

    <md-button class="md-secondary md-icon-button" ng-if="!showActionThree" ng-click="actionTwo('action two')">
      Two // secondary action
    </md-button>

    <md-button class="md-secondary md-icon-button" ng-if="showActionThree" ng-click="actionThree('action three')">
      Three // third action
    </md-button>
 </md-list-item>
</md-list>

The problem is that my function actionThreedoes not work.

It looks like when I use the class md-secondary, it creates a wraper that gets my function actionTwo, and this dos function does not change.

Is there any way to make this work?


Related Problem # 3744

+4
source share
2 answers

Try using only one button and a triple operator, for example:

<md-button class="md-secondary md-icon-button" ng-click="showActionThree ? actionThree('action three') :actionTwo('action two')">
  {{showActionThree ? 'Three': 'Two'}}
</md-button>
0
source

, , , . - ...

1.0.5, . , HEAD. , .

, . ng-mouseover ng-mouseout :

<md-list>
  <md-list-item ng-repeat="message in messages" ng-click='rowAction(message)'>
    <p>{{message.title}}</p>

    <md-button class="md-icon-button" ng-mouseover="action='two'" ng-mouseout="action=null">
      Two
    </md-button>

    <md-button class="md-icon-button" ng-mouseover="action='three'" ng-mouseout="action=null">
      Three
    </md-button>
 </md-list-item>
</md-list>

rowAction - :

$scope.rowAction = function (message){
    switch($scope.action){
        case 'two':
           $scope.actionTwo(message);
           break;
        case 'three':
           $scope.actionThree(message);
           break;
        default:
           $scope.actionOne(message);
    }
}
0

Source: https://habr.com/ru/post/1598059/


All Articles