Javascript 使用ng repeat创建动态列和行
我正在使用angularjs,我想用ng repeat创建动态行,但无法实现。我会在看到我的代码后清除。这是我的代码和:- td.controllers.js td.htmlJavascript 使用ng repeat创建动态列和行,javascript,html,angularjs,Javascript,Html,Angularjs,我正在使用angularjs,我想用ng repeat创建动态行,但无法实现。我会在看到我的代码后清除。这是我的代码和:- td.controllers.js td.html 月 {{product.name} A | B 试试这个代码 在这里,动态创建表头和表数据 如果您遇到任何问题,请告诉我 月 {{product.name} A | B 试试这个代码 在这里,动态创建表头和表数据 如果您遇到任何问题,请告诉我试试这个 var-app=angular.module(“myapp”,
月
{{product.name}
A | B
试试这个代码
在这里,动态创建表头和表数据
如果您遇到任何问题,请告诉我
月
{{product.name}
A | B
试试这个代码
在这里,动态创建表头和表数据
如果您遇到任何问题,请告诉我试试这个
var-app=angular.module(“myapp”,[]);
app.controller(“namesctrl”,函数($scope){
$scope.products=[{
姓名:“Abc”
}, {
名称:“比尔”
}, {
名称:“智能”
}];
});
月
{{product.name}
A | B
试试这个
var-app=angular.module(“myapp”,[]);
app.controller(“namesctrl”,函数($scope){
$scope.products=[{
姓名:“Abc”
}, {
名称:“比尔”
}, {
名称:“智能”
}];
});
月
{{product.name}
A | B
您希望A | B在哪里?在页眉还是正文中?A | B在哪里?头部还是身体?
function TodoCtrl($scope) {
$scope.products = [{
name: 'Abc'
}, {
name: 'Bil'
}, {
name: 'Smart'
}];
}
<div ng-app>
<div ng-controller="TodoCtrl">
<table class="table">
<thead>
<tr>
<th rowspan="2">Month</th>
<th ng-repeat="product in products" colspan="2">{{product.name}}</th>
</tr>
<tr>
<th>A</th> //I want to dynamic it
<th>B</th> //
</tr>
</thead>
</table>
</div>
</div>
-----------------------------
Month | Abc | Bil | Smart
| A|B | A|B | A|B
----------------------------
<div ng-app>
<div ng-controller="TodoCtrl">
<table class="table">
<thead>
<tr>
<th rowspan="2">Month</th>
<th ng-repeat="product in products">{{product.name}}</th>
</tr>
<tr>
<th></th> <!--I want to dynamic it-->
<th ng-repeat="product in products">A|B</th>
</tr>
</thead>
</table>
</div>
</div>