gpt4 book ai didi

angularjs - Angular UI Bootstrap 崩溃 - 怎么了?

转载 作者:行者123 更新时间:2023-12-04 16:07:11 26 4
gpt4 key购买 nike

我似乎无法让 angular ui bootstraps 折叠指令起作用。我已经用一个最小的例子设置了一个 plunkr,但它仍然不起作用。有人对此有所了解吗?

Plunkr

HTML

<!DOCTYPE html>
<html ng-app="app">

<head>
<link data-require="bootstrap-css@3.1.*" data-semver="3.3.1" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<script data-require="angular.js@*" data-semver="1.3.7" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.7/angular.js"></script>
<script data-require="ui-bootstrap@*" data-semver="0.12.0" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.0.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>

<body ng-controller="CollapseController">
<button class="btn btn-default" ng-click="collapsed = !collapsed">Toggle</button>
<div collapse="collapsed">
<div>
<h1>Hello Plunker!</h1>
</div>
</div>
</body>

</html>

JS

angular.module('app', [])
.controller('CollapseController', function($scope){
$scope.collapsed = false;
});

最佳答案

您需要声明 ui.bootstrap 模块依赖才能使用它:

angular.module('app', ['ui.bootstrap'])

关于angularjs - Angular UI Bootstrap 崩溃 - 怎么了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27701583/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com