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