1
私の角張ったプロジェクトは完了しています。問題は私がナビゲーションのためにng-routeを実装した後です。私のブートストラップnavbarは開きますが、崩壊しません。スタックオーバーフローで同様のソリューションをチェックして、多くを試しても機能しませんでした。どんな助けもありがとう。ブートストラップNavbarはng-Routerを使用して折り畳まれていません
--- HTML code ---
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand navbar-link" href="#/">Big Blue</a>
<button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcol-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navcol-1">
<ul class="nav navbar-nav navbar-right">
<li class="active" role="presentation"><a href="#/">Home </a></li>
<li role="presentation"><a href="#overview">Overview </a></li>
<li role="presentation"><a href="#map">Map </a></li>
</ul>
</div>
</div>
</nav>
------ app.js code -------
var app = angular.module("bigBlue", ["ngRoute"]); /* New module called big blue */
app.config(function($routeProvider) {
$routeProvider
.when('/', {
template: '<div main-slide-show></div>' // I moved my slideshow directive into the context of the index
}) // instead of the context of the entire application.
.when('/overview', { // pulling the slideshow directive out of the markup
templateUrl : 'overview.html',
controller : 'whaleController'
})
.when('/map', {
templateUrl : 'map.html',
controller : 'MapController',
})
.otherwise({
redirectTo : '/'
});
});
これは、ng-routeやahrefタグの略語と関係があります。私がindex.htmlまたはmaps.htmlを使用すると、ここでナビゲーションバーを閉じたり折りたたんだりしても問題はありません。ここではsimular問題です。http://stackoverflow.com/questions/32227296/when-i-use-ngrouter-navbar-is-壊れていない – Jonathan
さて、私は問題が何かを発見した。各ページにがロードされていました。私はこのスクリプトを他のhtmlページから取り除き、折りたたみ機能は他のすべてのページで正常に動作します。スクリプトはindex.htmlページでのみ実行されます。 – Jonathan