gpt4 book ai didi

jquery - 如何使用 Angular Bootstrap UI 在加载时填充第一个选项卡的内容

转载 作者:太空宇宙 更新时间:2023-11-03 17:50:39 24 4
gpt4 key购买 nike

我正在为选项卡使用 angular ui-bootstrap。我有第一个选项卡帐户的 ng-click ="ShowAccount()",我还希望在加载表单时触发相同的函数 ShowAccount()。元素在Asp.net中

html是

<html ng-app="ui.bootstrap.testData">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title> Tabs</title>
<link href="css/en/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="css/en/style.css" rel="stylesheet" type="text/css" />
<link href="css/en/ng-grid.css" rel="stylesheet" type="text/css" />
<link href="css/en/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="css/en/easyui.css" rel="stylesheet" type="text/css" />
<link href="css/en/icon.css" rel="stylesheet" type="text/css" />
<link href="css/en/demo.css" rel="stylesheet" type="text/css" />


</head>
<body>
<form id="formTabs" runat="server">
<div>
<div ng-controller="TabsDataCtrl">
<hr />
<tabset align="left">
<tab heading="Account" ng-click ="ShowAccount()"> Account
<div id ="divAccount">
<table id="PNRDataGrid" width="100%"></table>
<br />
</div>
</tab>
<tab heading="Policy">Policy content
<div>
<table border ="1" style ="background-color :blue">
<tr><td> Test</td></tr>
</table>

</div>
</tab>
<tab heading="LoB" ng-click ="ShowLob()">LOB content </tab>
<tab heading="Coverage">Coverage content</tab>
<tab heading="Detailed Loss">Detailed Loss</tab>
</tabset>
</div>

</div>
</form>
</body>
</html>

<script src="js/angular.js" type="text/javascript"></script>
<script src="js/ui-bootstrap-tpls-0.11.2.js" type ="text/javascript"></script>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/LossHistory.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>

js文件有代码

angular.module('ui.bootstrap.testData', ['ui.bootstrap']);
angular.module('ui.bootstrap.testData').controller('TabsDataCtrl', function($scope, $http) {

$scope.businessUnits = [];
$scope.lossHistory = [];

$scope.ShowAccount = function() {
$scope.loading = true;
alert('Account');
..
..


}

当用户点击“帐户”选项卡时,这工作正常,但我希望在加载时触发该功能 说这样的话: $(window).load(function() {} 在 (html) aspx 页面上。我不知道如何。如果我在 HTML 页面上添加

$(window).load(function() { showAccount();

}

正如预期的那样,它给出错误提示 showAccount() 未定义。有人可以帮忙吗?如果选项卡上有一个事件在加载或其他情况下被触发。谢谢。

当我用 select ="ShowAccount"替换 ng-click 时,它仍然没有帮助。 bootstrap.css的版本是v3.0.3,ui-bootstrap-tpls是0.11.2.js。我错过了什么吗?

最佳答案

您只想将 ng-click 替换为 select

select="ShowAccount()"

这是一个 Plunker

关于jquery - 如何使用 Angular Bootstrap UI 在加载时填充第一个选项卡的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27388913/

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