单击离子项时,突出显示由ng-repeat动态创建的离子项

时间:2016-04-14 07:47:44

标签: javascript html angularjs ionic-framework

当点击离子项时,我必须突出显示由ng-repeat动态创建的离子项。我已经尝试为每个项目分配一个id,然后将id传递给ng-click功能,该功能可以根据需要突出显示颜色。但是颜色没有变化。我错过了什么?。

这是html代码 -

`<ion-item id="{{WindReports.menuitemid}}" ng-repeat="WindReports in $root.UserWindAccess" menu-close href="{{WindReports.cAction}}" style="border : none !important;" ng-click="setClickedRow(WindReports.menuitemid)">
                            {{WindReports.cMenuName }}
</ion-item>

Controller.js -

$scope.setClickedRow = function (index) {
        document.getElementById(index).style.backgroundColor = red;
    }

0 个答案:

没有答案
相关问题