app.controller("dynamicDemoController",dynamicDemoController);
dynamicDemoController.$inject = ["NgTableParams","ngTableDemoCountries"];
function dynamicDemoController(NgTableParams,countries) {
this.cols = [//自定义table条目,过滤条件、表头名字和数据源,filterData: countries。
{ field: "name",title: "Name",filter: { name: "text" },show: true },{ field: "age",title: "Age",filter: { age: "number" },{ field: "money",title: "Money",{ field: "country",title: "Country",filter: { country: "select" },filterData: countries,show: true }
];
this.tableParams = new NgTableParams({
// initial filter
filter: { country: "Ecuador" } //初始化数据源
},{
dataset: simpleList
});
}
})();
(function() {
"use strict";
angular.module("myApp").run(setRunPhaseDefaults);
setRunPhaseDefaults.$inject = ["ngTableDefaults"];
//通过config来设置表格数量
function setRunPhaseDefaults(ngTableDefaults) {
ngTableDefaults.params.count = 5;
ngTableDefaults.settings.counts = [];
}
})();