我想用箭头显示方向,并考虑使用标准 ionic 箭头作为方向。 我能以某种方式将向上箭头旋转到任何方向吗?
ion-arrow-up-a
下面是评论的尝试
<i class="icon ion-arrow-up-a" rotate degrees="90"></i>
angular.module('app.customDirectives', []).directive('rotate', function() {
return {
link: function(scope, element, attrs) {
// watch the degrees attribute, and update the UI when it changes
scope.$watch(attrs.degrees, function(rotateDegrees) {
// console.log(rotateDegrees);
//transform the css to rotate based on the new rotateDegrees
element.css({
'-moz-transform': 'rotate(' + rotateDegrees + 'deg)',
'-webkit-transform': 'rotate(' + rotateDegrees + 'deg)',
'-o-transform': 'rotate(' + rotateDegrees + 'deg)',
'-ms-transform': 'rotate(' + rotateDegrees + 'deg)'
});
});
}
}
});
最佳答案
和上面类似,我就是这样做的...
HTML:
<i class="ion-arrow-up-c rotate-90">
CSS:
.rotate-90 {
display: inline-block;
transform: rotate(90deg);
}
关于javascript - 旋转页面上的 ionic 图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30857268/