I'm using AngularJS with Ionic to make an application. On a particular screen, I need to display a random image. I've tried a lot here and on the internet a way to do this, but I only managed with normal JS, without being in Angular and I have some doubts about how to "transform" to use in Angular.
var backgrounds = ['',
'bg3.jpg',
'bg1.jpg',
'bg1013.jpg',
'bg123.gif',
'bg553.jpg',
'bg663.png',
'bgdaas3.jpg',
'bgdw3.jpg',
'bgdd3.jpg',
'dasd.png'
];
$('#elementID').css('background','url('+backgrounds[Math.random()*10]+')');