[英]AngularJs ui.bootstrap issues - collapse not working
I am trying to make ui.bootstrap module work in Angularjs application. 我正在尝试使ui.bootstrap模块在Angularjs应用程序中工作。 Here is the code snippet.
这是代码片段。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Learn Angular</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-animate.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-route.js"></script>
<script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.2.5.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="app.js"></script>
</head>
<body>
<div class="container" ng-app="uiApp" ng-controller="uiController">
<a href="#" class="btn btn-primary" ng-click="isCollapsed = !isCollapsed">
Toggle Panel
</a>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a href="#" ng-click="isCollapsed = !isCollapsed">
Click here to collapse: {{isCollapsed}}
</a>
</h4>
</div>
<div collapse={{isCollapsed}}>
<div class="panel-body"> This Section should collapse
</div>
</div>
</div>
<pre><code>{{ isCollapsed }}</code></pre>
</div>
</body>
</html>
app.js app.js
angular.module('uiApp', ['ngRoute', 'ui.bootstrap', 'ngAnimate'])
.controller('uiController', function($scope) {
$scope.isCollapsed = false;
});
What am I doing wrong. 我究竟做错了什么。 I found the following question in stackoverflow,
我在stackoverflow中发现了以下问题,
collapse transition not working with angular's UI Bootstrap 崩溃过渡不适用于angular的UI引导程序
but it did not help. 但这没有帮助。
I tried in plunker - click here It doesn't work there either. 我尝试了“矮胖”- 单击此处那里也不起作用。
This worked for me. 这对我有用。 I replaced
我更换了
<div collapse={{isCollapsed}}>
with 与
<div uib-collapse="isCollapsed">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.