Ionic2 - Show/Hide button based on how the controller was shown
<p>I have a page <code>Page2</code> which needs to be open sometimes using a <code>modal()</code> and sometimes using a <code>push()</code>.</p>

<p>In the normal scenario, if the controller is opened using a push method it will show a "Back" button. However, in the other scenario which is opening the page using a <code>modal()</code> method, I need to add a close button to <code>Page2</code> so the user can dismiss that controller at any time.</p>

<p><strong>The Problem</strong></p>

<p>If I add a close button to <code>Page2</code> then that button shows even if the controller was opened using a <code>push()</code> method and in this case it shows a back button and a close button.</p>

<p><strong>What I want</strong></p>

<p>I want to add a condition, in which if the controller was opened using <code>push()</code>, then it should hide that close button</p>

<p><strong>The flow:</strong></p>

<p>Page 1 > (Push to) > Page 2 (Hide the close button)</p>

<p>Page 3 > (Modal to) > Page 2 (Show the close button)</p>

<p>Any idea on how to achieve that?</p>