LAZY LOADING in IONIC2
Short description of the problem:
Angular Router (Angular 2) has the ability to lazy load components, since Ionic is using its own router, will we have the functionality to lazy load the components?
What behavior are you expecting?
Lazy Loading Components
@jthoms1 I know where you're coming from... The Ionic Team pushed extremely on the benefits of and use of NavController, while being blind for simply that it isn't the magical solution...
During the period April - July it seemed, but..... As the NG2 Team also realized, it's not that simple... Then, later-on, with NG2-Router appearing, from July onwards, your team, The Ionic Team, went numb. At first you all didn't want to believe it... NG2 came up with AoT (oh, first, with NgModule in their last RC) with all its benefits and of course(, and I do acknowledge!!) limitations on HOW to get "it" right (AoT), which still is cumbersome....
So, yes, even though I understand your struggles, I do believe you (The Ionic Team) should NEVER try to get OFF the path of being a UX Layer - nothing wrong with that!!! You're perfect at it, even the best most people might say....
Why I have such a strong opinion?... Well, I've lost a tremendous amount of time on "promising" technologies (Telerik ORM, I have forgotten their name for it... Luckily... Microsofts technologies ASP.net or their ORM implementations - horrible)... I've invested months on these, right to the waste bin... And I really see your team is losing (free) customers (developers) choosing for Nativescript (Telerik!!) now....
I understand your business model.... 99% free... Getting paid by the 1%... or 80%-20%... I can't look in your kitchen... But an investor putting a seed of 10 million is not stupid.... A well thought model, which obviously works!! For you as a company AND for the community as a whole....
Having said this, and please see it this way, because this is exactly how I mean it!!! :-) Please!! FOCUS on the UX handling - get rid of the NavController religion... And concur Onsen. Not tomorrow, but today.
A little side note - I'm not a deep developer, even though I'm now 46 and "on a computer from my 8th" (Sinclair XZ81).... I'm definitely technical, but more an entrepreneur / strategy planner, who's now building a new social network, having to learn all new languages, Docker, Vertx, NG2, Redis etc... I kept myself alive being an Oracle expert :-D not paying taxes when I earned loads.... etc....
And yes, I learned the hard way not ever want to have server-side tech (ASP.net nor PHP) taking care a 10.000s "clients"... Servers are to serve - not more, not less... Files - not sessions... :-)
Okay, enough said.....
REMOVE NavController!!! - it is outside your scope
ps. thnx @jvitor83 @ivaylopivanov @bobrosoft for your support and of course @mohammedzamakhan for opening this issue!!!
@Dutchboy,
Your comments are completely inappropriate and there is no place for that sort of disrespect here. Please review our code of conduct before posting in our Github organization again. We take this matter very seriously. This is a friendly, collaborative place for all parties and throwing around insults is unacceptable.
Don't like the NavController? Don't use it 😸. There isn't anything preventing developers from using the Angular Router if they so choose. I can assure you - using the NG Router will not fix the size problems right now. I have added the IonicModule to the Angular CLI numerous times to test various things out. The same problems exist. Feel free to do the same if you'd rather use the router.
We don't use the NG Router because we have different use cases. We designed our deep linking and NavController system to match how iOS and Android apps navigate. For example, imagine you navigate to a page of the app. You scroll half-way down. Then you navigate to a different page, and then return. With our navigation system, you'll return to the same scroll position since that's how apps work. With the Angular router, you will return to the top of the page. That's one of many examples. We did not build this in a silo - we meet with Misko and the Angular team very regularly. They understand and support our design decision here.
Thanks, Dan
All,
We are working on the problem. We are well aware it exists. We will have a solution available as soon as it's ready. This is our primary focus and something we know we need to have available ASAP.
This is not a problem that is exclusive to Ionic. Every Angular project has the same problems right now. We see it more because we are a large project built on top of Angular. Angular apps are huge right now. We We are working closely with the Angular team to resolve the issues.
We would love to have a schedule or a time table, but the reality is many of the things are out of our hands. We have our own host of problems in Ionic that we have been resolving, but we are also pushing our dependencies to resolve their issues. We worked with the Angular team to change how Angular is packaged for Version 4, so that will help a lot. Ultimately, the problem is that Webpack, Rollup, etc think that the transpiled ES5 code has side effects, and then it cannot remove unused code, resulting in large sizes. So, basically there are a slew of bugs in Webpack and Rollup that are hurting us. Closure Compiler is smart enough to know the side effects don't exist and results in a tiny Ionic app, but it is hard to use Closure Compiler so we're not so sure that's a viable option. Rather than waiting for Rollup and Webpack to fix their issues, we decided with Angular that we are going to take a different approach and bundle everything as ES2015 code. That means we need to wait for Angular to be distributed as ES2015 code. This is not a silver bullet, though. There have been lots of fixes/changes to Angular and Ionic over the past month or two to fix various small problems in the framework that were increasing bundle size. We had a week long meeting in Mountain View with the Angular team to go over everything and experiment on how we can resolve some of the issues the two projects have.
Ultimately, when I say we're working on it, that's exactly what I mean. We haven't added any features to the framework itself in months. We have multiple staff members trying to solve the problems. We are doing exactly what we say we are doing, and we will ship out the solution the day it's ready.
I am going to lock this thread. It's not constructive and distracting.
Thanks, Dan