我的 html
中有这一行,我希望能够从 Controller
更改样式
<i class="fa fa-caret-left fa-2x" ng-click="$ctrl.decrementPage()" ng-style="leftArrow()" aria-hidden="true"></i>
我为 Controller 定义了一个类,但我似乎无法获得正确的语法来更改元素的样式。这是我到目前为止所拥有的:
public leftArrow = () => {
'color': '#0095FF',
'cursor': 'pointer'
}
我收到 :
错误,其中显示应为 ;
。
最佳答案
我认为应该是:
leftArrow = function() {
return {
'color': '#0095FF',
'cursor': 'pointer'
}
}
<i ng-click="$ctrl.decrementPage()" ng-style="$ctrl.leftArrow()"></i>
关于css - Controller 中的 ng 风格语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41723291/