---------home.html----------
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js">
</script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script>
<script src="main.js"></script>
<script src="aboutController.js"></script>
<script src="sharedDataService.js"></script>
<script src="sampleController.js"></script>
<script src="profileController.js"></script>
<div ng-app="myApp" ng-controller="aboutController">
<div class="col-md-8" style="text-align:center; width:190px; margin-top:160px;">
<ul class="nav nav-pills nav-stacked">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#/profle">Profile</a></li>
<li role="presentation"><a href="#/modal" data-toggle="modal" data-target="#myModal">Messages</a></li>
</ul>
</div>
<div class="col-md-10" style="text-align:center; margin-top:70px;" ng-view>
</div>
</div>
</html>
------main.js----------
angular.module("myApp", ["ngRoute"]).config(function($routeProvider) {
$routeProvider
.when("/go", {
templateUrl : "sample.html",
controller : "sampleController"
})
.when("/profile", {
templateUrl : "profile.html",
controller : "profileController"
})
.when("/modal", {
templateUrl : "modal.html"
})
.otherwise({
templateUrl : "profile.html",
controller : "profileController"
});
});
-------modal.html-------
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
我正在angularjs中创建一个测试应用程序。我正在使用Bootstrap模式,当我点击&#34;消息&#34;在home.html页面中链接。路由也发生在点击该链接但是当我点击此链接时,路由发生但Bootstrap模式在首次点击链接时没有打开但是当我再次点击时在链接上,它打开了。有人能告诉我为什么会这样吗?那是什么解决了这个问题?