marianocodes/offline-ionic

Unable to use lazy-img in another page.

AlainLiu opened this issue · 3 comments

I cloned the project and run ionic --serve.

the code works well in home.html.

But if I copy it to another 2 pages like contact.html or about.html,

Then there goes error .

Could someone help me to solve this problem? Many Thanks ~

PS. I'm new to Ionic.

Hi @boy1988, I'll update the repo as soon as I can. But to fix the issue, just need to create a module for the lazy-component and lazy-directive, so you can import it into other modules.

That new module needs to be imported into the modules that each page has

The current folder structure does not help. I'll change it to work by features so each feature has it's own module.

I'm so glad to get your response.

I'm a back-end enginner and just beginning working with angular & Ionic . I'm looking for an easy way to cache my app's avatar to mobile its local , so that there is no need to download a picture everytime a use start my app.

I wonder why the markup works well in home.html but not in about.html or contact.html.

Hope any new features would be added. Thanks for your reply again~

Hi @boy1988, I've updated the code. I took a new approach, where all the imgCache.js functions will work in reactive way. Also I've created a module dedicated to the img-cache, where you can import into other modules even if they are loaded lazily.