{"id":1113,"date":"2014-10-10T04:00:00","date_gmt":"2014-10-10T01:00:00","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=1113"},"modified":"2014-10-10T18:53:39","modified_gmt":"2014-10-10T15:53:39","slug":"twitter-bootstrap-navbar-as-angularjs-component","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/","title":{"rendered":"Twitter Bootstrap Navbar as AngularJS Component"},"content":{"rendered":"<p>You all know <a href=\"http:\/\/twitter.github.com\/bootstrap\/\">Twitter Bootstrap<\/a>, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We are using Bootstrap based design in our current project that also uses AngularJS and as we are planning to have many new pages, we decided that\u2019s the earlier we introduce some components to our UI the better. And, what shouldn\u2019t be a surprise, navigation bar natually became the first candidate.<\/p>\n<h2>Overview<\/h2>\n<p>So in this post I am going to show how externalize Twitter Bootstrap Navbar into a separate, flexible AngularJS component. All source code is available in <a href=\"https:\/\/github.com\/tdziurko\/twitter-bootstrap-navbar-as-angularjs-directive\">my GitHub repository<\/a> , so everything should be easy to follow and repeat.<\/p>\n<h2>Basic setup<\/h2>\n<p>To start from the basics, I\u2019ve prepared three pages that use the same navigation bar. These pages will soon become our super simple web application using AngularJS:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/navbar_angularjs1.png\"><img decoding=\"async\" class=\"aligncenter wp-image-1194 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/navbar_angularjs1.png\" alt=\"navbar_angularjs1\" width=\"660\" height=\"317\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/navbar_angularjs1.png 660w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/navbar_angularjs1-300x144.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<p>Next step will be adding AngularJS and converting three pages into one small application. This is done in this <a href=\"https:\/\/github.com\/tdziurko\/twitter-bootstrap-navbar-as-angularjs-directive\/commit\/9d135332ef5e934920a65975f41fb06f6cc852a8\">commit<\/a>. And after that we are ready to start working on our Navbar component.<\/p>\n<h2>Problem<\/h2>\n<p>On each page we have very similar html fragment rendering navbar element.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;div class=&quot;navbar navbar-inverse&quot;&gt;\r\n    &lt;div class=&quot;navbar-inner&quot;&gt;\r\n        &lt;div class=&quot;container&quot;&gt;\r\n            &lt;a class=&quot;brand&quot;&gt;Example App&lt;\/a&gt;\r\n\r\n            &lt;div class=&quot;nav-collapse&quot;&gt;\r\n                &lt;ul class=&quot;nav&quot;&gt;\r\n                    &lt;li class=&quot;active&quot;&gt;&lt;a href=&quot;home.html&quot;&gt;Home&lt;\/a&gt;&lt;\/li&gt;\r\n                    &lt;li&gt;&lt;a href=&quot;second.html&quot;&gt;Second&lt;\/a&gt;&lt;\/li&gt;\r\n                    &lt;li&gt;&lt;a href=&quot;third.html&quot;&gt;Third&lt;\/a&gt;&lt;\/li&gt;\r\n                &lt;\/ul&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>The only difference is in where class <em>active<\/em> which highlights link is located. And every time we see such repetition, our DRY detector should start ringing and don\u2019t stop until we do something about it.<\/p>\n<h2>Simple directive<\/h2>\n<p>For a start, we will move this code fragment into a AngularJS directive. At first, it will be only a \u201cdumb\u201d piece of code that just renders the same html in different places. All html from the listing above is now located in the components\/bootstrapNavbar.html file.<\/p>\n<p>Next thing we need is a directive declaration in JS file:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">angular.module('navbarapp', &#x5B;'controllers'])\r\n  .directive('bootstrapNavbar', function() { \/\/ (1)\r\n  return {\r\n    restrict: 'E',         \/\/ (2)\r\n    replace: true,         \/\/ (3)\r\n    transclude: true,      \/\/ (4)\r\n    templateUrl: 'bootstrapNavbar.html'    \/\/ (5)\r\n  }});\r\n;<\/pre>\n<p>What happens here:<\/p>\n<ol>\n<li>we declare directive, please keep in mind that name of directive you use in the code will be boostrap-navbar, camelCase is transformed into \u2013 character.<\/li>\n<li>restrict: E \u2013 means that directive is used as an element, there are other options: C-class, A-attribute, more on <a href=\"http:\/\/docs.angularjs.org\/guide\/directive\">docs<\/a><\/li>\n<li>replace: true \u2013 means that markup from template will completely replace directive element in the page markup<\/li>\n<li>transclude: true \u2013 what it means\u2026 you better tell me, I am not able to describe it more vaguely that it is done in the <a href=\"http:\/\/docs.angularjs.org\/guide\/directive\">docs<\/a> ;)<\/li>\n<li>templateUrl \u2013 file where we store our template content<\/li>\n<\/ol>\n<p>After that we should replace navbar html markup on every page with something like:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">&lt;bootstrap-navbar&gt;&lt;\/bootstrap-navbar&gt;<\/pre>\n<p>Now it\u2019s high time to test it. Unfortunately there is one problem. Security policy does not allow browser to execute XHR(Ajax) calls from html file stored on our disk. So we have to setup lightweight httpServer to serve our files to browser. You can do it using Jetty or anything similar. I tried one from Python and it worked without issues. So basically navigate to directory where all files are stored, execute:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">python -m SimpleHTTPServer 9000<\/pre>\n<p>and then open your browser using address <a href=\"http:\/\/localhost:9000\/home.html\">http:\/\/localhost:9000\/home.html<\/a>. You should see the same page as before, but now it is using our directive.<\/p>\n<h2>Flexibility++<\/h2>\n<p>So we have our first directive, yay! But its IQ is not that high. If you navigate to Second and Third Page, you will notice that it always renders link to Home Page as active, which is not exactly true for all pages. And in this paragraph we will try to make it smarter.<\/p>\n<p>At first, let\u2019s add attribute <em>current-tab<\/em> to our directive usages:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">&lt;bootstrap-navbar current-tab='Second'&gt;&lt;\/bootstrap-navbar&gt;<\/pre>\n<p>Passed value must be the same as link name in the navbar, so in our example app it should be either: Home, Second or Third.<\/p>\n<p>Next step is to prepare our template file for easy modification. Because we will use jQuery selectors to find link to activate, we will remove active class and also add an id attribute to <em>ul<\/em> element to make it easier to locate with selector:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;div class=&quot;navbar navbar-inverse&quot;&gt;\r\n    &lt;div class=&quot;navbar-inner&quot;&gt;\r\n        &lt;div class=&quot;container&quot;&gt;\r\n            &lt;a class=&quot;brand&quot;&gt;Example App&lt;\/a&gt;\r\n\r\n            &lt;div class=&quot;nav-collapse&quot;&gt;\r\n                &lt;ul class=&quot;nav&quot; id=&quot;navigation-tabs&quot;&gt;     &lt;!-- id added here --&gt;\r\n                    &lt;li&gt;&lt;a href=&quot;..\/home.html&quot;&gt;Home&lt;\/a&gt;&lt;\/li&gt;   &lt;!-- removed class='active' --&gt;\r\n                    &lt;li&gt;&lt;a href=&quot;..\/second.html&quot;&gt;Second&lt;\/a&gt;&lt;\/li&gt;\r\n                    &lt;li&gt;&lt;a href=&quot;..\/third.html&quot;&gt;Third&lt;\/a&gt;&lt;\/li&gt;\r\n                &lt;\/ul&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<h2><strong>Core logic<\/strong><\/h2>\n<p>Now the last thing we have to do is some jQuery selector magic with little addition of AngularJS magic :)<\/p>\n<p>Angular directives have function <em>compile<\/em> which allows to alter directive template markup, so we will use it here. What this function receives is value of parameters defined on the component usage in our pages, so basically we have an access to all attributes that are declared where our navbar component is used, specifically our <em>current-tab<\/em> attribute (again transformed to <em>currentTab<\/em> inside JS file). So when we know which link should be highlighted, jQuery selectors come to do the actual job:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">angular.module('navbarapp', &#x5B;'controllers'])\r\n  .directive('bootstrapNavbar', function() {\r\n  return {\r\n    restrict: 'E',\r\n    replace: true,\r\n    transclude: true,\r\n    templateUrl: 'components\/bootstrapNavbar.html',\r\n    compile: function(element, attrs) {  \/\/ (1)\r\n      var li, liElements, links, index, length;\r\n\r\n      liElements = $(element).find('#navigation-tabs li');   \/\/ (2)\r\n      for (index = 0, length = liElements.length; index &lt; length; index++) {\r\n        li = liElements&#x5B;index];\r\n        links = $(li).find('a');  \/\/ (3)\r\n        if (links&#x5B;0].textContent === attrs.currentTab) $(li).addClass('active'); \/\/ (4)\r\n      }\r\n    }\r\n  }});\r\n;<\/pre>\n<p>So what we do here:<\/p>\n<ol>\n<li>define compile function that has passed two things, element on which it is called (template markup in our case) and attrs, an object with all attributes declared where our directive was used.<\/li>\n<li>select all list items from #navigation-tabs node<\/li>\n<li>find all links there, it will be only one<\/li>\n<li>if text content of link is equal to currentTab attribute we know that this is the link to highlight, so we simply add proper CSS class there<\/li>\n<\/ol>\n<p>It\u2019s the simplest working solution. Of course we could add some error checking, but I wanted to show easy to follow approach to introducing flexible components to AngularJS applications.<\/p>\n<h2>Summary<\/h2>\n<p>In this post I tried to show how with a few simple steps we could apply DRY rule to our html markup in AngularJS application. And as your application grow, you will probably find more and more places where html is duplicated making it a good candidate to convert it into component directive.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/tomaszdziurko.pl\/2013\/02\/twitter-bootstrap-navbar-angularjs-component\/\">Twitter Bootstrap Navbar as AngularJS Component<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/wcg\/\">WCG partner<\/a> Tomasz Dziurko at the <a href=\"http:\/\/tomaszdziurko.pl\/\">Code Hard Go Pro<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>You all know Twitter Bootstrap, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We are using Bootstrap based design in our current project that also uses AngularJS and as we are planning to have many new pages, we decided that\u2019s the earlier we &hellip;<\/p>\n","protected":false},"author":9,"featured_media":909,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-1113","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Twitter Bootstrap Navbar as AngularJS Component - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"You all know Twitter Bootstrap, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Twitter Bootstrap Navbar as AngularJS Component - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"You all know Twitter Bootstrap, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-10T01:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-10-10T15:53:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tomasz Dziurko\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tomasz Dziurko\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/\"},\"author\":{\"name\":\"Tomasz Dziurko\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/5d5c74963e7f64b33d8cf3c9567a66a3\"},\"headline\":\"Twitter Bootstrap Navbar as AngularJS Component\",\"datePublished\":\"2014-10-10T01:00:00+00:00\",\"dateModified\":\"2014-10-10T15:53:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/\"},\"wordCount\":1288,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"articleSection\":[\"Angular.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/\",\"name\":\"Twitter Bootstrap Navbar as AngularJS Component - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"datePublished\":\"2014-10-10T01:00:00+00:00\",\"dateModified\":\"2014-10-10T15:53:39+00:00\",\"description\":\"You all know Twitter Bootstrap, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Angular.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Twitter Bootstrap Navbar as AngularJS Component\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/5d5c74963e7f64b33d8cf3c9567a66a3\",\"name\":\"Tomasz Dziurko\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g\",\"caption\":\"Tomasz Dziurko\"},\"sameAs\":[\"http:\/\/tomaszdziurko.pl\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/tomasz-dziurko\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Twitter Bootstrap Navbar as AngularJS Component - Web Code Geeks - 2026","description":"You all know Twitter Bootstrap, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We","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:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/","og_locale":"en_US","og_type":"article","og_title":"Twitter Bootstrap Navbar as AngularJS Component - Web Code Geeks - 2026","og_description":"You all know Twitter Bootstrap, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2014-10-10T01:00:00+00:00","article_modified_time":"2014-10-10T15:53:39+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","type":"image\/jpeg"}],"author":"Tomasz Dziurko","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Tomasz Dziurko","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/"},"author":{"name":"Tomasz Dziurko","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/5d5c74963e7f64b33d8cf3c9567a66a3"},"headline":"Twitter Bootstrap Navbar as AngularJS Component","datePublished":"2014-10-10T01:00:00+00:00","dateModified":"2014-10-10T15:53:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/"},"wordCount":1288,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","articleSection":["Angular.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/","name":"Twitter Bootstrap Navbar as AngularJS Component - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","datePublished":"2014-10-10T01:00:00+00:00","dateModified":"2014-10-10T15:53:39+00:00","description":"You all know Twitter Bootstrap, don\u2019t you? It\u2019s the awesome library to make your web application looks pretty good without spending many hours on CSS. We","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/twitter-bootstrap-navbar-as-angularjs-component\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Angular.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/"},{"@type":"ListItem","position":4,"name":"Twitter Bootstrap Navbar as AngularJS Component"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/5d5c74963e7f64b33d8cf3c9567a66a3","name":"Tomasz Dziurko","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4536ab9b39bda1ff3eadf8fef1745ba7b5e25b01a37900598b1b9f4285d0176e?s=96&d=mm&r=g","caption":"Tomasz Dziurko"},"sameAs":["http:\/\/tomaszdziurko.pl\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/tomasz-dziurko\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/1113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=1113"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/1113\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/909"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=1113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=1113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=1113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}