2017-04-13 67 views
1

我想要在不同的URL上獲取發佈操作。當我試圖編寫不同的工廠時,我想它可能會認識到其他工廠。

Service.js

var app = angular.module("ServiceApp", ["ngResource"]); 

    app.factory('GetPortfolios', function ($resource) { 
    return $resource("http://localhost:61347/api/PortfolioManager/GetPortfolios/", {}, { 
    }); 

    app.factory('GetOrders', function ($resource) { 
     return $resource("http://localhost:61347/api/PortfolioManager/GetPortfolioOrders/"); 
    }); 
}); 

App.js

var app = angular.module("UiApp", ["ServiceApp"]); 

app.controller("PortFolioController", function ($scope, GetPortfolios) { 
    $scope.Portfolios = GetPortfolios.query({ pmid: 2 }); 
    console.log($scope.Portfolios); 
}); 

app.controller("OrderController", function ($scope, GetOrders) { 
    $scope.Orders = GetOrders.query({ id: 25 }); 
    console.log(Orders); 
}); 
+1

兩個工廠都缺少'});'關閉方括號ry函數 –

+0

@PankajParkar我認爲只有第一個! – Sajeetharan

回答

1

您Service.js內,第一家工廠缺少收盤}) paranthesis,檢查更新Service.js

var app = angular.module("ServiceApp", ["ngResource"]); 

app.factory('GetPortfolios', function ($resource) { 
    return $resource("http://localhost:61347/api/PortfolioManager/GetPortfolios/", {}, {}); 
}); 

app.factory('GetOrders', function ($resource) { 
    return $resource("http://localhost:61347/api/PortfolioManager/GetPortfolioOrders/"); 
}); 
相關問題