手风琴点击标题后无法正常工作

时间:2016-01-05 10:14:16

标签: angularjs twitter-bootstrap-3

代码在单页时工作正常但是当我在我的角度应用程序中添加时代码无效,当用户点击手风琴标题然后它链接到(#collapse id) 当我添加到我的应用程序时,我的代码有什么问题。                                  http://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js">

</head>
<body>

<div class="container">
<h2>Accordion Example</h2>
<p><strong>Note:</strong> The <strong>data-parent</strong> attribute makes sure that all collapsible     elements under the specified parent will be closed when one of the collapsible item is shown.</p>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">login</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse in">
<div class="panel-body">
<form>
<input type="text">
<input type="password">
<input type="button" value="login">
</form>
</div>
</div>
</div>    
</body>
</html>

1 个答案:

答案 0 :(得分:0)

如果你想使用像AngordJS的Accordion这样的Bootstrap组件,你需要使用它们的特定绑定。可以在this GitHub project找到它们(带有一些示例代码)。

您需要更换上面的常规Bootstrap JavaScript文件,并确保获得包含模板的版本,否则它无法开箱即用。包含模板的文件在文件名中包含tpls。有很多关于如何使用此代码的示例,但请随时询问您是否还有其他问题。