How IONIC NavController works, when nav.push components? - ionic-framework

i have 3 pages in my Ionic 3:
first page : a tabs page which contains a list of articles.
second page: contains information detail of article and a button that will fire third page for commenting the article.
third page : contains a field for comment and a button to submit data to API Server.
the problem is i use navController.push to redirect back to the tabs page (first page) later user submitted the comment and after user commented like 5 articles my ionic application gets more more slow and crash. it really slows to open second page.
i assume that it because of navController.push, if user commented 5 articles n redirected back to first page it means that it will be like 5 stack of component in the stack list.
my question is NavController.push performs by reference or not? and what does make my application slow?
IONIC 3

Look at the documentation, nav controller has pop and popToRoot methods
Each time you push it will create new instance, but even 5 pages in the stack is nothing so probably you have some listeners in code with heavy logic
Look at Lifecycle events, specially in your root page you will probably need to implement ionViewWillEnter to reload articles

Related

Prevent Component reloading - AEM

I have 2 pages in my web application. Lets say an home page and news feed page. When user clicks a hyperlink on home page then she/ he gets redirected to News feed page. I have 2 separate components in each page like
Home Page --- Header Component & Home Page Details Component.
News Feed Page --- Header Component & News Feed Details Component.
Both the pages has a common component Header. Can I prevent component reloading for the header component when users reaches the second page by clicking link on the first page.
By component reloading I mean the HTML code (HTL) code in the component should not be updated again with updated data instead for the second page, I just want to show the same data associated with header component in the first page.
A new page will always be loaded as a whole, because of just how [HTML] page loads work. What you are looking for is a single page application. They are possible with AEM but are a pain to design, especially the authoring mode behaviour.
This is a very common HTML pattern and possible duplicate of related questions such as: How to auto refresh a section of a page
There are two general approaches, the first being far preferred and supported in various frameworks, all based on JavaScript (AJAX):
Break page into different DIV tags that are independently updated (header separate from body sections, each loaded via AJAX such that only part of the page that has changed is updated).
Use iFrames such that effectively there are different pages - each loaded separately from the other.

How to link multiple pages in GWT

I am new to GWT and so my knowledge is restricted.
Right now I have created a simple Login page which will take my user to another page and then based on the choices that the user makes, it will direct it to the next page. I have created 3 individual pages but I have no clue how to link them. Can someone please help.
In GWT typically you do not create separate pages - you create separate "views". They may look like pages to an end user, but in reality the entire app works in a single HTML "host" page.
You may want to look at the Activities and Places design pattern. It takes care of navigation between different "places" within your app.
very simple example with a DeckPanel. It shows only the selected 'page' and hides the other ones
DeckPanel deckPanel = new DeckPanel();
deckPanel.add(page1);
deckPanel.add(page2);
deckPanel.add(page3);
deckPanel.showWidget(0);
//deckPanel.showWidget(1);
//deckPanel.showWidget(2);

Change transition per submit tag in a form with jQuery Mobile

Is it possible that different submit tags in a form in a web site that's using jQuery Mobile (1.3.1) will trigger different transitions and/or directions?
Just to throw my towel in.
Now for the question you've asked, the answer is a YES. You can use a randomizing sequence to choose the transition at runtime and pass the URL and the transition to changePage, which will redirect you to the url you provided. More at jQM docs
Here's a demo of the randomised transitions : http://jsfiddle.net/hungerpain/fpw6B/
Now for your second question - No, you neednt have an ajax callback for this to work. When changePage is called, this is the operation which happens:
hides the current page
takes the URL you provided through your code
fetches the page through ajax (if the url provided is an external page)
appends it after the current page
shows the new page
As you can see, it doesnt necessarily need ajax.
Hope these answer your questions.

Wicket page versioning and history support

Could anyone explain me what is the Wicket's page versioning useful for? There is an article in the FAQ that is related to this topic:
Wicket stores versions of pages to support the browser's back button.
Suppose you have a paging ListView with links in the ListItems, and you've clicked through to display the third page of items. On the third page, you click the link to view the details page for that item. Now, the currently available state on the server is that you were on page 3 when you clicked the link. Then you click the browser's back button twice (i.e. back to list page 3, then back to list page 2, but all in the browser). While you're on page 2, the server state is that you're on page 3. Without versioning, clicking on a ListItem link on page 2 would actually take you to the details page for an item on page 3.
But unfortunately I don't understand it at all. When I click on a ListItem on page 2, I would expect to get to the page defined by that Link - details page for the item. Why should I get on the details page of the item on page 3?
Moreover, when one press the back button in a browser, it doesn't call the server at all. Is it right?
So how this versioning works?
No, the server is not notified when you press the back button. I'll try to explain what happens in the example:
You access you application for the first time. On the server, a page 'list' is created, used to render the HTML you see in your browser, and stored as page v1. You see the first 10 items of the list.
You click the 'next' link, and it refers to a link in page v1. On the server, page v1 is loaded, the link logic is executed (to advance the pagination), the page is used to render HTML, and is stored as page v2. You see items from 11 to 20.
You click the 'next' link, and it refers to a link in page v2. On the server, page v2 is loaded, the link logic is executed (to advance the pagination), the page is used to render HTML, and is stored as page v3. You see items from 21 to 30.
You click the 'details' link for item 25, and it refers to the link for the 5th item in page v3 (this page only shows 10 items, and the link, even if it refers to the 25th item in the complete list, in this page it's just the 5th). On the server, page v3 is loaded, its logic is executed, page 'detail' is created, stored as page v4, and you are redirected to it. Your browser requests page v4, the server loads it, and uses it to render your HTML page (no new version is stored, since it's just rendering). You see the details for item 25.
You click the browser's 'back' button 2 times, and see page 'list' showing items 11 to 20, referring to page v2 (list). Then you click a link 'details' for item 13. On the server, page v2 is loaded (not v4, the last one executed), since the link clicked pointed to this page version. Then, the 3rd item link's logic is executed, a new page 'details' is created, stored as page v5, and you are redirected to it. The browser requests page v5, the server loads it, and uses it to render your HTML. You see the details for item 3.
All this may seem strange if you come from a Struts-like background, where you always just put the item id or which page to show as a link parameter. In Wicket, the usual case is to store all state in the server, and navigation is not done by the client (direct link to another page passing parameters), but in the server. A link just asks the server to execute code in a page object version, the navigation is done all server-side.
You could argue that the Struts style is simpler (and you can do it in Wicket too, it just isn't optimal), but keeping the state only in the server has many advantages. Fist, once you get used to it, it's actually much easier. No need to add every single param to a pagination link (search parameters, first item, page length, sorting column, order direction, etc.). Also, you avoid many security issues (you can't just change the URL id param to an arbitrary value and access other users' data), and can control everything from Java code instead of mixed Java-Javascript (you still can do it if you want, though).

Facebook Multiple Tabs

I would like to add Tabs on my Facebook Page - Welcome, Register, Deals etc. Do i need to create that many facebook applications and then serve it or can i can one application and have many tabs and serve them from the same ?
You will need to have many "Page Tab apps" that you would add to your page, as different tabs. But if you are fine with having only one tab in your page, and then have more tabs within that, then you can make just one "page tab app" and add it to your page.
So i guess its mainly a ux issue. So if you want users to first navigate to your new tab and then have them see more tabs in its iframe, then you add one page tab app. Otherwise if you want many tabs in your page itself then you will need to make more page tab apps for each functionality.
I don't think it's possible to have one app serve many tabs into your Facebook page, as you can specify only one url from where to pull data, plus you can't specify more than one tab name, which basically means that a Facebook page tab app can have only one page tab within Facebook. However that url could have tabs (like any web app) but obviously those will be rendered within the iframe for that tab in your page.
i hope this answers your question. seems a little confusing to myself! Do ask for clarifications if required.