Rotate ionion on the page
I want to display directions with an arrow and was thinking of using a standard ionic arrow for the direction. Can I rotate the arrow up in any direction?
ion-arrow-up-a
Here is an attempt from the comments below
<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)'
});
});
}
}
});
+3
source to share
4 answers
There are other options for arrows:
ion-arrow-up-a
ion-arrow-right-a
ion-arrow-down-a
ion-arrow-left-a
Or ... As I know the ionic framework is HTML5 based, so you can use CSS styles.
.style {
-moz-transform: rotate(15deg);
-webkit-transform: rotate(15deg);
-o-transform: rotate(15deg);
-ms-transform: rotate(15deg);
transform: rotate(15deg);
}
If you want dynamic rotation you should check this url .
+5
source to share