刚学习angularjs,我需要实现的功能是查询功能,即输入查询条件,然后以表单形式返回结果。代码如下:
// THIS IS BUTTON CLICK SEARCH
var app = angular.module("myApp", []); app.directive("datepicker", function () { return { restrict: "A", link: function (scope, el, attr) { el.datepicker(); } }; }) .controller("searchCtrl", function ($scope, $http) { $scope.SearchTerm = function () { var url = 'http://localhost:5100/terms?agentids=' + $scope.agentName + '&hrdate=' + $scope.date2 + '&callback=JSON_CALLBACK'; $http.jsonp(url).success(function (data) { $scope.termsInfo = data; }).error(function (data, status, headers, config) { $scope.events = "fail"; }) }; }); //this is form present. var app1 = angular.module('myTermTable', ['ngTable']); app1.controller('tableCtrl', function ($scope, ngTableParams) { var data=...(json data) $scope.tableParams = new ngTableParams({ page: 1, // show first page count: 10 // count per page }, { total: data.length, // length of data getData: function ($defer, params) { $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count())); } }); })
我发现以上两个angular.module("myApp", [])不能合并,我该如何处理这个查询操作。。急。。