Angularjs code won't work on device


#1

I have created a codepen of what I am trying to do in in IONIC.

Inside the codepen an image is brought in and I apply a filter using camanjs. Inside the codepen this is working. I then try to apply this into ionic, but it will not work. When I click a filter it goes as far as the code ‘if (effect in this)’ in the caman function and prints 'Effect is GOOD" in the console, but on the phone the canvas becomes white and that is it.


#2

Your code pen doesn’t work in Chrome or Safari. Have you checked whether the library you are using is supported by Chrome and Safari?


#3

I don’t have safari installed so I can’t test but in chrome it is working. I have Version 43.0.2357.132 m of chrome and everything seems to work. I also now just tested it on an older version of chrome and it is working there too. May you please specify what is not working for you?


#4

Sorry, by work I mean if I click on the name of a filter, the filter gets applied to the image.


#5

I just get a white screen after clicking on your code pen


#6

That is what I receive in my chrome.


#7

Have you installed the white list plugin to your ionic app and also set it to allow all hosts with “*”?

I wonder if the script being hosted on a CDN is being blocked from running. If you look at your logs on your device that should give you more information too. Any logs or errors you get could be helpful to us.


#8

The CDN is only for codepen since I can’t include local scripts. Inside my ionic application though I have the camanjs script locally installed and the library is being called because I get the ‘Effect is GOOD’ message inside my console.log which is called from my ‘Caman’ function.


#9

There isn’t really anything else we can do here to see what’s breaking. Can you make an ionic project with that in there and upload it some how so we can see it happening? We can take your ionic source and compile it locally to test on different devices


#10

I have just noticed on my android device if I run the codepen from my mobile browser (chrome) it does not work. If I run it inside chrome on my desktop it does work. So it looks like a browser issue?


#11

Possibly. It worked fine on my mobile safari. I don’t have chrome installed on my phone to check that, though.


#12

Found the issue. If a HiDPI display is detected, CamanJS will automatically switch to the HiDPI version if available unless you force disable it with the data-caman-hidpi-disabled attribute. So I had to add this to my canvas and make it equal to true.


#13

So is the hidpi version incompatible with chrome/android browser then? It rendered fine for me on iOS.

If you haven’t I would look into crosswalk for cordova and android. If it renders using crosswalk then you can get the hidpi version and not worry about whatever your rendering being blurry.


#14

So it goes back to what I said about browser support. Just like @NorthMcCormick said you might need to look at using Crosswalk as Chrome on iOS uses Safari webview.