{"id":271,"date":"2015-01-07T02:00:00","date_gmt":"2015-01-07T02:00:00","guid":{"rendered":"http:\/\/localhost\/?p=271"},"modified":"2015-12-16T19:45:31","modified_gmt":"2015-12-16T19:45:31","slug":"navigating-the-changes","status":"publish","type":"post","link":"https:\/\/ionic.io\/blog\/navigating-the-changes","title":{"rendered":"Navigating the Changes"},"content":{"rendered":"<p>Before releasing Beta 14, we took some time to gather feedback from the Ionic community about how navigation UI should behave: not just how it should be animated, but how everything comes together in an app. In Beta 14, we made some major changes to the navigation structure and elements that follow some already well-established patterns that can be found in apps across all platforms. We feel these updates will smooth the process of building UI navigation for your app.<\/p>\n<p><!--more--><\/p>\n<h3>Nav buttons<\/h3>\n<p>In Beta 14, we introduced a new navbar inheritance structure. Any collection of elements in <code>&lt;ion-nav-buttons&gt;<\/code> or <code>&lt;ion-nav-title&gt;<\/code> will replace what\u2019s in the header by default or from the main top-level view (likely your index.html file).<\/p>\n<p>In many cases, you\u2019ll want just one <code>&lt;ion-nav-bar&gt;<\/code>, and then you\u2019ll add the appropriate buttons for that page to the page\u2019s template.<\/p>\n<p>In the example below, we define a nav-bar, with a button on the right, and then make a view that has a button on the left. When that view renders, it will contain both buttons, so the view will inherit any button that is already in the nav-bar.<\/p>\n<p>Your typical structure will be:<\/p>\n<pre><code>&lt;!-- index.html --&gt;\n&lt;ion-nav-bar&gt;\n  &lt;ion-nav-buttons side=&quot;secondary&quot;&gt;\n    &lt;button class=&quot;button&quot; ng-click=&quot;doSomething()&quot;&gt;\n      Add\n    &lt;\/button&gt;\n  &lt;\/ion-nav-buttons&gt;\n&lt;\/ion-nav-bar&gt;\n&lt;ion-nav-view&gt;\n&lt;\/ion-nav-view&gt;\n\n&lt;!-- some view template --&gt;\n&lt;ion-view&gt;\n  &lt;ion-nav-buttons side=&quot;primary&quot;&gt;\n    &lt;button class=&quot;button&quot; ng-click=&quot;doSomethingElse()&quot;&gt;\n      More\n    &lt;\/button&gt;\n  &lt;\/ion-nav-buttons&gt;\n  &lt;ion-content&gt;\n    Some super content here!\n  &lt;\/ion-content&gt;\n&lt;\/ion-view&gt;\n<\/code><\/pre>\n<h3>Navigation base<\/h3>\n<p>Before we released Beta 14, we revisited the way we felt navigation UI should behave. Components like our <code>ion-tab<\/code> and our <code>ion-side-menus<\/code> now have a lot more purpose behind them. Like their native counterparts, these components have become a base for navigation.<\/p>\n<p>Let\u2019s look at our side-menus:<\/p>\n<pre><code class=\"html\">    &lt;ion-side-menus enable-menu-with-back-views=&quot;false&quot;&gt;\n\n    &lt;ion-side-menu-content&gt;\n      &lt;ion-nav-bar class=&quot;bar-positive&quot;&gt;\n        &lt;ion-nav-back-button&gt;\n        &lt;\/ion-nav-back-button&gt;\n        &lt;ion-nav-buttons side=&quot;left&quot;&gt;\n          &lt;button class=&quot;button button-icon button-clear ion-navicon&quot; menu-toggle=&quot;left&quot;&gt;\n          &lt;\/button&gt;\n        &lt;\/ion-nav-buttons&gt;\n      &lt;\/ion-nav-bar&gt;\n      &lt;ion-nav-view name=&quot;menuContent&quot;&gt;&lt;\/ion-nav-view&gt;\n    &lt;\/ion-side-menu-content&gt;\n\n    &lt;ion-side-menu side=&quot;left&quot;&gt;\n      &lt;ion-content&gt;\n        &lt;ul class=&quot;list&quot;&gt;\n          &lt;a href=&quot;#\/event\/check-in&quot; class=&quot;item&quot; menu-close&gt;Check-in&lt;\/a&gt;\n          &lt;a href=&quot;#\/event\/attendees&quot; class=&quot;item&quot; menu-close&gt;Attendees&lt;\/a&gt;\n        &lt;\/ul&gt;\n      &lt;\/ion-content&gt;\n    &lt;\/ion-side-menu&gt;\n\n    &lt;\/ion-side-menus&gt;\n<\/code><\/pre>\n<p>In that left side-menu, you probably have a list of links to other pages in your app, while in the side-menu-content, you\u2019d have a nav-view to render these pages. In Beta 14, those links in the side-menu now trigger a change in the navigation stack. The view gets treated as a navigation root and has animation only on the child views.<\/p>\n<p>As a result, you may not be able to use side-menus haphazardly in any view. The use of a menu should be to create a base of navigation, through which views will transition. For a more contextual menu, developers should consider components like <a href=\"http:\/\/codepen.io\/ionic\/pen\/GpCst\">popover<\/a> or <a href=\"http:\/\/codepen.io\/ionic\/pen\/gblny\">modal<\/a>.<\/p>\n<h3>Menu Toggle Visibility<\/h3>\n<p>In our navigation research, we discovered that existing native SDKs that have a similar side-menu component and navigation stack automatically hide the menu toggle (hamburger) icon-button icon on child pages; it\u2019s only visible on root level pages. We agree with this UX approach and have made it possible using <code>enable-menu-with-back-views=&quot;false&quot;<\/code> on the <code>&lt;ion-side-menus&gt;<\/code> element. <a href=\"http:\/\/ionicframework.com\/docs\/nightly\/api\/directive\/ionSideMenus\/\">ionSideMenus Docs<\/a>.<\/p>\n<h3>View LifeCycle<\/h3>\n<p>In order to improve performance, we&#8217;ve improved Ionic&#8217;s ability to cache view elements and scope data. Once a controller is initialized, it may persist throughout the app\u2019s life; it\u2019s just hidden and removed from the watch cycle. Since we aren\u2019t rebuilding scope, we\u2019ve added events for which we should listen when entering the watch cycle again.<\/p>\n<table class=\"table\">\n<tbody>\n<tr>\n<td><code>$ionicView.loaded<\/code><\/td>\n<td>The view has loaded. This event only happens once per view being created and added to the DOM. If a view leaves but<br \/>\nis cached, then this event will not fire again on a subsequent viewing. The loaded event is good place to put your setup<br \/>\ncode for the view; however, it is not the recommended event to listen to when a view becomes active.<\/td>\n<\/tr>\n<tr>\n<td><code>$ionicView.enter<\/code><\/td>\n<td>The view has fully entered and is now the active view.<br \/>\nThis event will fire, whether it was the first load or a cached view.<\/td>\n<\/tr>\n<tr>\n<td><code>$ionicView.leave<\/code><\/td>\n<td>The view has finished leaving and is no longer the<br \/>\nactive view. This event will fire, whether it is cached or destroyed.<\/td>\n<\/tr>\n<tr>\n<td><code>$ionicView.beforeEnter<\/code><\/td>\n<td>The view is about to enter and become the active view.<\/td>\n<\/tr>\n<tr>\n<td><code>$ionicView.beforeLeave<\/code><\/td>\n<td>The view is about to leave and no longer be the active view.<\/td>\n<\/tr>\n<tr>\n<td><code>$ionicView.afterEnter<\/code><\/td>\n<td>The view has fully entered and is now the active view.<\/td>\n<\/tr>\n<tr>\n<td><code>$ionicView.afterLeave<\/code><\/td>\n<td>The view has finished leaving and is no longer the active view.<\/td>\n<\/tr>\n<tr>\n<td><code>$ionicView.unloaded<\/code><\/td>\n<td>The view&#8217;s controller has been destroyed, and its element has been<br \/>\nremoved from the DOM.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>An example of using these events would be:<\/p>\n<pre><code class=\"javascript\">$scope.$on(&#039;$ionicView.afterEnter&#039;, function(){\n  \/\/ Any thing you can think of\n});\n<\/code><\/pre>\n<h3>Parting Words<\/h3>\n<p>With these updates, Ionic now has a more complete structure for navigation and view management. Check out the docs for more information.<\/p>\n<p><a href=\"http:\/\/ionicframework.com\/docs\/api\/directive\/ionNavView\/\">ionNavView<\/a><\/p>\n<p><a href=\"http:\/\/ionicframework.com\/docs\/api\/directive\/ionNavButtons\/\">ionNavButtons<\/a><\/p>\n<p><a href=\"http:\/\/ionicframework.com\/docs\/api\/directive\/ionSideMenus\/\">ionSideMenus<\/a><\/p>\n<p><a href=\"http:\/\/ionicframework.com\/docs\/api\/directive\/ionTabs\/\">ionTabs<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before releasing Beta 14, we took some time to gather feedback from the Ionic community about how navigation UI should behave: not just how it should be animated, but how everything comes together in an app. In Beta 14, we made some major changes to the navigation structure and elements that follow some already well-established [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"publish_to_discourse":"","publish_post_category":"","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"","discourse_permalink":"","wpdc_publishing_response":"","wpdc_publishing_error":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-271","post","type-post","status-publish","format-standard","hentry","category-all","tag-ionic"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.0 (Yoast SEO v23.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Navigating the Changes - Ionic Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ionic.io\/blog\/navigating-the-changes\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Navigating the Changes\" \/>\n<meta property=\"og:description\" content=\"Before releasing Beta 14, we took some time to gather feedback from the Ionic community about how navigation UI should behave: not just how it should be animated, but how everything comes together in an app. In Beta 14, we made some major changes to the navigation structure and elements that follow some already well-established [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ionic.io\/blog\/navigating-the-changes\" \/>\n<meta property=\"og:site_name\" content=\"Ionic Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-07T02:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-12-16T19:45:31+00:00\" \/>\n<meta name=\"author\" content=\"Mike Hartington\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mhartington\" \/>\n<meta name=\"twitter:site\" content=\"@ionicframework\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike Hartington\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ionic.io\/blog\/navigating-the-changes#article\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/navigating-the-changes\"},\"author\":{\"name\":\"Mike Hartington\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b\"},\"headline\":\"Navigating the Changes\",\"datePublished\":\"2015-01-07T02:00:00+00:00\",\"dateModified\":\"2015-12-16T19:45:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/navigating-the-changes\"},\"wordCount\":682,\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"keywords\":[\"Ionic\"],\"articleSection\":[\"All\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ionic.io\/blog\/navigating-the-changes\",\"url\":\"https:\/\/ionic.io\/blog\/navigating-the-changes\",\"name\":\"Navigating the Changes - Ionic Blog\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/#website\"},\"datePublished\":\"2015-01-07T02:00:00+00:00\",\"dateModified\":\"2015-12-16T19:45:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/ionic.io\/blog\/navigating-the-changes#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ionic.io\/blog\/navigating-the-changes\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ionic.io\/blog\/navigating-the-changes#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ionic.io\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Navigating the Changes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ionic.io\/blog\/#website\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"name\":\"ionic.io\/blog\",\"description\":\"Build amazing native and progressive web apps with the web\",\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ionic.io\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/ionic.io\/blog\/#organization\",\"name\":\"Ionic\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"width\":1920,\"height\":854,\"caption\":\"Ionic\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/ionicframework\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b\",\"name\":\"Mike Hartington\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png\",\"caption\":\"Mike Hartington\"},\"description\":\"Director of Developer Relations\",\"sameAs\":[\"https:\/\/twitter.com\/mhartington\",\"https:\/\/x.com\/mhartington\"],\"url\":\"https:\/\/ionic.io\/blog\/author\/mike\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Navigating the Changes - Ionic Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ionic.io\/blog\/navigating-the-changes","og_locale":"en_US","og_type":"article","og_title":"Navigating the Changes","og_description":"Before releasing Beta 14, we took some time to gather feedback from the Ionic community about how navigation UI should behave: not just how it should be animated, but how everything comes together in an app. In Beta 14, we made some major changes to the navigation structure and elements that follow some already well-established [&hellip;]","og_url":"https:\/\/ionic.io\/blog\/navigating-the-changes","og_site_name":"Ionic Blog","article_published_time":"2015-01-07T02:00:00+00:00","article_modified_time":"2015-12-16T19:45:31+00:00","author":"Mike Hartington","twitter_card":"summary_large_image","twitter_creator":"@mhartington","twitter_site":"@ionicframework","twitter_misc":{"Written by":"Mike Hartington","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ionic.io\/blog\/navigating-the-changes#article","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/navigating-the-changes"},"author":{"name":"Mike Hartington","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b"},"headline":"Navigating the Changes","datePublished":"2015-01-07T02:00:00+00:00","dateModified":"2015-12-16T19:45:31+00:00","mainEntityOfPage":{"@id":"https:\/\/ionic.io\/blog\/navigating-the-changes"},"wordCount":682,"publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"keywords":["Ionic"],"articleSection":["All"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ionic.io\/blog\/navigating-the-changes","url":"https:\/\/ionic.io\/blog\/navigating-the-changes","name":"Navigating the Changes - Ionic Blog","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/#website"},"datePublished":"2015-01-07T02:00:00+00:00","dateModified":"2015-12-16T19:45:31+00:00","breadcrumb":{"@id":"https:\/\/ionic.io\/blog\/navigating-the-changes#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ionic.io\/blog\/navigating-the-changes"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ionic.io\/blog\/navigating-the-changes#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ionic.io\/blog"},{"@type":"ListItem","position":2,"name":"Navigating the Changes"}]},{"@type":"WebSite","@id":"https:\/\/ionic.io\/blog\/#website","url":"https:\/\/ionic.io\/blog\/","name":"ionic.io\/blog","description":"Build amazing native and progressive web apps with the web","publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ionic.io\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ionic.io\/blog\/#organization","name":"Ionic","url":"https:\/\/ionic.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","width":1920,"height":854,"caption":"Ionic"},"image":{"@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/ionicframework"]},{"@type":"Person","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b","name":"Mike Hartington","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png","caption":"Mike Hartington"},"description":"Director of Developer Relations","sameAs":["https:\/\/twitter.com\/mhartington","https:\/\/x.com\/mhartington"],"url":"https:\/\/ionic.io\/blog\/author\/mike"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/comments?post=271"}],"version-history":[{"count":0,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/271\/revisions"}],"wp:attachment":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/media?parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/categories?post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/tags?post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}