Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this works fine in browser and ripple but not worked when app installed on device #10

Closed
ghostgrass opened this issue Dec 8, 2015 · 14 comments

Comments

@ghostgrass
Copy link

this works fine in browser and ripple but not worked when app installed on device.
but change cache-src to ng-src then the image could be shown.
Any idea on this?

@ghostgrass
Copy link
Author

now got the rootcause: if use {{}} like cache-src="{{testpic}}", then it will fail to get pic because attrs.$observe('cacheSrc', could not be excuted.
any idea on how to fix it?

@mlzxy
Copy link
Owner

mlzxy commented Dec 8, 2015

Would you mind to try to install this demo app https://github.com/BenBBear/ionic-cache-src-demo on your testing device and see what happens?

And the console error from chrome remote debugger will be very helpful.

@ghostgrass
Copy link
Author

Thanks for reply.
i tried but that demo has same issue. this issue could be fixed by using scope.$watch('attrs.cacheSrc', to replace attrs.$observe('cacheSrc'.
is there any impact from your perspective for this change?
谢谢

@ghostgrass
Copy link
Author

my nick name is 笨笨熊 too :)

@mlzxy
Copy link
Owner

mlzxy commented Dec 8, 2015

好奇怪,你这个问题是只在android上才发生吗?

我刚才在android emulator上测没问题, 另外ios有没有这个问题?

@ghostgrass
Copy link
Author

只有安卓上有,ios上 没问题,而且只有使用{{}}绑定才有问题,直接用url没问题

@mlzxy
Copy link
Owner

mlzxy commented Dec 10, 2015

自己试的时候的android是没有问题的, 而且ios成功,android失败,估计是android webview的问题了。。。 你测试的android系统version大概多少

@wahyuway
Copy link

i had problem in real android device too. Using emulator also the same problem. I use windroye as emulator. No error also from debug.

if run using ionic serve, it works well.

Edited: after some investigation, i thought it must be relevant to how to access file on the android.
I add this <preference name="AndroidPersistentFileLocation" value="Internal" /> to config.xml and it works fine now. Tested in real device and windroye emulator.

Reference:https://github.com/apache/cordova-plugin-file

@mlzxy
Copy link
Owner

mlzxy commented Dec 18, 2015

@wahyuway

Awesome! Thank you so much for the solution you brought up. I will add this to readme.

This could be a good explanation for some not working issues about android!

However, as @ghostgrass mentioned, using $scope.$watch instead of attr.$observe could fix some failed cases in android while both are fine in iOS. I guess there may exist angular support issues in some particular versions of webview. But I never encounter it, if more people complain, I will change it.

@trinvh2
Copy link

trinvh2 commented Jan 6, 2016

Hi, add preference via @wahyuway still not working.
I have 2 page, homepage and detail page. In detail page it work but homepage its not render src attribute.
I inspected on chrome, no exception occurs.

@seasonstar
Copy link

Hi,
I encountered this issue on device in iOS 9.2, ionic 1.2.4.
And I found a solution.
Just replace
" $ionicPlatform.ready().then(function() { " in line 268
with
"$ionicPlatform.ready(function() {".

Then it works perfect~

@johnnyoin
Copy link

Thanks @seasonstar, it indeed corrects the problem.

@mlzxy
Copy link
Owner

mlzxy commented Mar 5, 2016

I fix the these bugs together with some else, and add video/audio support and more examples.

Thank you guys for helping!!

@mlzxy mlzxy closed this as completed Mar 5, 2016
@King-JXN
Copy link

King-JXN commented Sep 3, 2016

Maybe there is another solution, which is replace image with div by setting "src-is" to "background".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants