Angularjs 如何将ui.bootstrap折叠功能设置为页面加载时折叠?

Angularjs 如何将ui.bootstrap折叠功能设置为页面加载时折叠?,angularjs,twitter-bootstrap,Angularjs,Twitter Bootstrap,我正在使用ui.bootstrap并尝试使用该函数 在我的代码中,默认状态是展开的,当单击load weather按钮时,div折叠,数据加载后展开 我需要对我的代码做什么才能使其在页面加载时处于折叠状态,并且只有在单击按钮时才展开/收缩 这是我的密码: <div ng-controller="weatherCtrl"> <div> <button ng-model="hotel" class="btn btn-default"

我正在使用
ui.bootstrap
并尝试使用该函数

在我的代码中,默认状态是展开的,当单击
load weather
按钮时,
div
折叠,数据加载后展开

我需要对我的代码做什么才能使其在页面加载时处于折叠状态,并且只有在单击按钮时才展开/收缩

这是我的密码:

<div ng-controller="weatherCtrl">
    <div>
        <button ng-model="hotel" class="btn btn-default" 
          ng-click="loadWeather(hotel); isCollapsed = !isCollapsed">load weather</button>
        <hr>
        <div collapse="isCollapsed">
            <div class="well well-lg">Some content</div>
        </div>
    </div>
</div>

.controller('weatherCtrl', function ($scope, weather) {

    $scope.loadWeather = function (hotel) {
        console.log('loadWeather')
        console.log('hotel')
        console.log(hotel)

        weather.get({}, function (data) {
            console.log('data')
            console.log(data)
            $scope.isCollapsed = false;
        })
    }
})

负荷天气

一些内容 .controller('weatherCtrl',函数($scope,weather){ $scope.loadWeather=功能(酒店){ console.log('loadWeather') console.log('hotel') 控制台日志(酒店) weather.get({},函数(数据){ console.log('data')) console.log(数据) $scope.isCollapsed=false; }) } })
我通过在父元素上使用
ng init
使其工作:

<div ng-controller="weatherCtrl" ng-init="isCollapsed = !isCollapsed">
    <div>
        <button ng-model="hotel" class="btn btn-default" 
          ng-click="loadWeather(hotel)">load weather</button>

        <hr>

        <div collapse="isCollapsed">
            <div class="well well-lg">Some content</div>
        </div>
    </div>
</div>

负荷天气

一些内容
单击功能如何保留在此处?您还必须对控制器进行了更改。当我有分钟时,我将查看我的代码,并查看我所做的其他更改。我不知道我所做的更改,但您可以在此处查看: