I am studying bootstrap by making changes to examples. The drop down menu that I am trying to create should have three links. The main tab should link to someroute
, while the two links that are revealed by the drop down menu should let users click to route3
and route4
respectively. But instead there is a dead link where there should be three working links. What specific changes need to be made to the code below to make all four links in the menu bar work, including the three in the drop down?
Here is a plnkr that recreates the problem including the code below.
Here is index.html, which includes the bootstrap code for the drop down menu:
<!DOCTYPE html>
<html>
<head>
<script>document.write('<base href="' + document.location + '" />');</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-route.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link href="style.css" rel="stylesheet"/>
<style type="text/css">
[ng\:cloak], [ng-cloak], .ng-cloak { display: none !important; }
</style>
</head>
<body class="ng-cloak" ng-cloak="" ng-app="hello">
<div class="container" ng-controller="navigation">
<ul class="nav nav-pills" role="tablist">
<li ng-class="{active:tab('home')}"><a href="/">Home</a></li>
<li class="dropdown">
<a ng-class="{active:tab('someroute')}" class="dropdown-toggle" data-toggle="dropdown" href="/someroute">Some route
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li ng-class="{active:tab('route3')}"><a href="/route3">route three</a></li>
<li ng-class="{active:tab('route4')}"><a href="/route4">route four</a></li>
</ul>
</li>
</ul>
</div>
<div class="container" ng-view=""></div>
<script type="text/javascript" src="home.js"></script>
<script type="text/javascript" src="someroute.js"></script>
<script type="text/javascript" src="navigation.js"></script>
<script type="text/javascript" src="script.js"></script>
</body>
</html>