'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination', ////分页用到的插件 'ngSanitize'///$sanitize这个服务.此服务依赖于ngSanitize模块.(这个模块需要加载angular-sanitize.js插件) ////应用ng-bind-html如果不引用此模块,会报安全错误 ]); app.controller("prjListCtrl", ["$http", "$scope", function ($http, $scope) { var self = this; var get_userid = "7ac641ab-8940-4a50-8a0e-afe1b6d1cda1"; var postCfg = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, transformRequest: function (data) { return $.param(data); } }; ////请求api的网址 self.webApiUrl = ""; self.getApiUrlData = function () { var data = { } $http.get("../../config.txt", data, postCfg) .success(function (res) { self.webApiUrl = res.webApiUrl; }); }; self.getApiUrlData(); //数据表格的控制器,动态加载table表格数据 self.noDataTip = 1; //声明没有数据时变量 self.rows = []; //declare an empty array self.pageno = 1; // initialize page no to 1 self.total_count = 0; self.itemsPerPage = 8; //this could be a dynamic value from a drop down self.pageOptions = [8, 12, 16, 20, 24, 26]; //// self.getData = function (pageno) { // This would fetch the data on page change. self.pageno = pageno; $scope.__default__currentPage = self.pageno; //设置页面样式在第几页 var data = { userid:get_userid, pagesize: self.itemsPerPage, pageno: self.pageno }; ///为了演示 var jsonUrl = "json/list.txt?ctime="+new Date(); $http.get("" + jsonUrl + "", data, postCfg) .success(function (res) { //console.log(res); if (res.Items == null || res.Items == undefined || res.Items == "") { self.noDataTip = 0; } else { self.noDataTip = 1; self.mainTableName = res.mainTableName; self.rows = res.Items; //ajax request to fetch data into self.data self.total_count = res.total_count; } }); }; self.getData(1); }]);