で解決された後intead配列のオブジェクトの配列を与える私は私のHTTPサービス(UserServiceの)中に次のコードを持っている:角度の約束は、コントローラ
module1.factory('UserService', ['$http', '$q', function($http, $q) {
return {
getModelValueTableValues1: function(CarLine, GeographyType, GeographyName, Duration, ModelId, ScenarioId, TimeKey) {
return $http.get('http://localhost:8080/scenarioplan/models/data?ScenarioId=5&CarLine=Nissan%20-%20Rogue&TimeKey=Jul-16&Duration=1&Geographytype=National&GeographyName=National&ModelId=1001')
.then(
function successCallback(response) {
return response.data;
},
function errorCallback(errResponse) {
console.error('Error while fetching Model Parameter Table');
return $q.reject(errResponse);
}
);
},
をし、私は自分のコントローラに次のコードを持っている:
を$scope.getModelValueTableValues = function(CarLine, Geography, Duration, ModelId, ScenarioId) {
UserService.getModelValueTableValues1(CarLine, Geography.split('-')[0], Geography.split('-')[1], Duration, ModelId, ScenarioId, '16-Jul')
.then(
function(d) {
console.log("the data object from promise is", d);
console.log("the data object from promise is", d.length);
console.log('The Promise has been successfully resolved!!!!');
},
function(errResponse) {
console.error('The Promise was not successfull');
}
);
};
データの配列を返す代わりに、プロミスは解決された後、デバッグウィンドウ(F12)の下の画像に示すようにオブジェクトの配列を返します。
以下F12コンソール出力が示すように、Webサービスの呼び出しからの応答に有効なデータに思える:
誰かがこの問題を解決するために私を助けてくださいことはできますか? 私は一日を通してこれを解決しようとしていますが、成功することはありません!
あなたの '応答 'には何がありますか? http:// localhost:8080/scenarioplan/models/data?ScenarioId = 5&CarLine = Nissan%20-%20ログ&TimeKey = 7月16日と期間= 1&Geographytype = National&GeographyName = National&ModelId = 1001'これは返信しますか? –
こんにちは@SusheelSingh、私質問に画像を添付しました。 – Sabyasachi
'データの配列'はもう少し説明できますか? –