drutcs7210 2017-02-08 06:17
浏览 105

如何使用相同的ng-controller检索多个页面上的多个表的记录?

I have 2 dashboards with index.php 1.offers.php 2.terminatio.php on offers page i have below script with myCtrl controller to fetch records of offers table. Its working.

var app = angular.module('myApp', []);  
app.controller('myCtrl', function($scope, $http) {
    $http.get("http://www.adhr.adnacgroup.com/ADHRM/companyJson.php")
    .then(function(response) {
        $scope.names = $scope.names = response.data.service;});
        getInfo();    
        function getInfo() {
            $http.post('getTask.php').success(function(data) {
                $scope.details = data;
            })
        }

Now, same code I am using on termination page

var app = angular.module('myApp', []);  
app.controller('termination', function($scope, $http) {
    $http.get("http://www.adhr.adnacgroup.com/ADHRM/companyJson.php")
    .then(function(response) {
        $scope.names = $scope.names = response.data.service;
    });
    getInfo();    
    function getInfo() {
        $http.post('gettermination.php').success(function(data) {
            $scope.details = data;
    })
}

on both page I'm using different controllers. and on index.php I called ng-app. I'm able to fetch only offers script. termination's script is not working.please help me with the same I'm totally new in angular

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 目详情-五一模拟赛详情页
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line