# Ionic 2 global navbar component

**URL:** <https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989>\
**Category:** ionic-v3\
**Created:** [July 19, 2016, 6:06pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989 "2016-07-19T18:06:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![asrinivasan](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@asrinivasan](https://forum.ionicframework.com/u/asrinivasan)\
**Post date:** [July 19, 2016, 6:06pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/1 "2016-07-19T18:06:19Z")

</div>

I am fairly new to Ionic 2, so please excuse me if this a question with an obvious answer. I am trying to build an application with a global navbar component. I attempted creating a navbar component by following this post: [http://stackoverflow.com/questions/35936198/ionic-2-global-navbar-for-the-app](http://stackoverflow.com/questions/35936198/ionic-2-global-navbar-for-the-app). After running my application in the browser, I still cannot see the navbar component. When I inspect the html, I see something like:

`<navbar> <!--template bindings={}--> </navbar>`

It looks like the component is being bound correctly, but the actual data within the component is not being served. My question is: is it possible for me to create a global navbar in such a way? Or do I need to replicate the navbar HTML on every page of my application?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2016, 6:21pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/2 "2016-07-19T18:21:08Z")

</div>

I commented on the stackoverflow, but that is not the correct answer.

There is no way to create a global ion-navbar, as this is done on purpose. The point of having a navbar defined for each component is so that we can properly animate the titles, navbar background color (if you change them) and animate other properties needed.

---

<div class="post-metadata">

**Author:** ![asrinivasan](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@asrinivasan](https://forum.ionicframework.com/u/asrinivasan)\
**Post date:** [July 19, 2016, 6:25pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/3 "2016-07-19T18:25:54Z")

</div>

Thanks for the reply - that makes sense.

---

<div class="post-metadata">

**Author:** ![asrinivasan](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@asrinivasan](https://forum.ionicframework.com/u/asrinivasan)\
**Post date:** [July 20, 2016, 11:23pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/4 "2016-07-20T23:23:04Z")

</div>

@mhartington I understand why you can’t have a global navbar, so I am replicating the same navbar html across all my pages that share the navbar. Do I then also have to replicate the corresponding typescript functions that define which page to navigate to when a button on my navbar is selected? Or is the convention to create and call a service that does this?

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 20, 2016, 11:27pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/5 "2016-07-20T23:27:46Z")

</div>

I would definitely not use a service to do anything involving navigation.

---

<div class="post-metadata">

**Author:** ![asrinivasan](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@asrinivasan](https://forum.ionicframework.com/u/asrinivasan)\
**Post date:** [July 20, 2016, 11:29pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/6 "2016-07-20T23:29:56Z")

</div>

@rapropos thanks for the input. What would you say is the best way to reduce code duplication in such a case? I’m dealing with quite a large project, so it would be helpful to have navigation in some centrally-defined way.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 20, 2016, 11:38pm UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/7 "2016-07-20T23:38:30Z")

</div>

I would try wrapping it in a custom component along the lines of @brandyscarney’s comment near the end of [this discussion](https://github.com/driftyco/ionic/issues/6004).

---

<div class="post-metadata">

**Author:** ![asrinivasan](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@asrinivasan](https://forum.ionicframework.com/u/asrinivasan)\
**Post date:** [July 21, 2016, 12:00am UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/8 "2016-07-21T00:00:08Z")

</div>

This is along the lines of what I was thinking when I initially started this discussion - I was wondering if it was okay to create a custom component for the navbar and use a directive to reference it. However, @mhartington brought up how doing this is not correct, as inhibits the ability to properly animate titles.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 21, 2016, 12:04am UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/9 "2016-07-21T00:04:42Z")

</div>

I guess we just have to have an Ionic team member deathmatch.

---

<div class="post-metadata">

**Author:** ![asrinivasan](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@asrinivasan](https://forum.ionicframework.com/u/asrinivasan)\
**Post date:** [July 21, 2016, 12:08am UTC](https://forum.ionicframework.com/t/ionic-2-global-navbar-component/57989/10 "2016-07-21T00:08:44Z")

</div>

Indeed 🙂 - thanks for taking a stab at it. Would appreciate a comment on this from @mhartington when he gets a chance.
