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);
});
兩個工廠都缺少'});'關閉方括號ry函數 –
@PankajParkar我認爲只有第一個! – Sajeetharan