0
我有一個按鈕菜單,角度動態創建。如果我按下一個按鈕,它會顯示一張包含一些數據的表格。當我打開應用程序時,如何按下默認顯示的第一個按鈕的數據?我的意思是,不按下按鈕?然後當我按下另一個按鈕時要更改的值。這可能嗎?我的代碼:默認角度自動按下按鈕
<div ng-repeat="group in groups" class="btn-group">
<button type="button" class="btn btn-primary" ng-click="switchGroup(group.id)">{{ '{{ group.code}}' }}</button>
</div>
<div ng-show="repartizations.length == 0"><h2> There is no schedule for this group.</h2></div>
<table class="table table-responsive" ng-show="repartizations.length > 0">
...
</table>
角:
$http.get('/api/group/specialization/' + $state.params.valueSpecialization).then(function (success) {
$scope.groups = success.data;
}
);
$scope.switchGroup = function (groupId) {
$http.get(
'/api/repartition/group/' + groupId
).then(function (success) {
$scope.repartizations = success.data;
});
};
它的工作,謝謝你:)我會盡可能接受你的答案。 – IleNea