我正在尝试使ui.bootstrap模块在 Angularjs 应用程序中工作。这是代码片段。
<!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>
应用程序.js
angular.module('uiApp', ['ngRoute', 'ui.bootstrap', 'ngAnimate'])
.controller('uiController', function($scope) {
$scope.isCollapsed = false;
});
我究竟做错了什么。我在stackoverflow中发现了以下问题,
折叠过渡不适用于 Angular 的 UI Bootstrap
但它没有帮助。
我在 plunker 中尝试过 -单击此处 它也不起作用。