我想訪問另一個對象內部的對象,但是每當我對其進行控制時,它都會顯示'undefined'。 例另一個對象的訪問對象
$scope.instrumento = new Instrumento();
$scope.empresaInstrumento = EmpresaInstrumento.get({id:$routeParams.id}, function (instrumento) {
$scope.instrumento = instrumento.instrumento;
console.log($scope.instrumento);
});
console.log($scope.instrumento);
我怎樣才能得到這個對象「INSTRUMENTO」出來的「empresaInstrumento」沒有失去他的參考?
(在得到方法從API信息)
做您的控制檯INSTRUMENTO,並檢查是否有INSTRUMENTO? –
是的,它有。 「empresaInstrumento」顯示對象「empresa」和「instrumento」。 當我控制檯empresaInstrumento.instrumento不斷顯示'未定義',但裏面的功能,它顯示正確的儀器 –
什麼版本的角?您的服務EmpresaInstrumento.get使用$ http還是自定義承諾? – gyc