我想访问另一个对象内部的对象,但是每当我对其进行控制时,它都会显示'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