간단히 말해서 내 API에서 정보를 얻고 있으며 응답이 좋습니다. 내가보기에 vm.thisDoctor에 접근하고 이제
vm.getDoctor = function(id) {
$http.get(CONSTANTS.LINK+'/doctors/'+id).success(function(response) {
vm.thisDoctor = {
name : response.first_name + ' ' + response.last_name,
address : response.clinical_address,
};
console.log(vm.thisDoctor.address);
$state.go('tabs.doctor');
});
}
console.log(response)
의지 출력,
Object {id: 1, username: "testmd", first_name: "Juan",
last_name: "Dela Cruz", type: "Pediatrician"…}
컨트롤러 의사 - this.html 여기 내 app.js
<a class="item item-thumbnail-left">
<img src="cover.jpg">
<h2>{{ appt.thisDoctor.name }}</h2>
<p>{{appt.thisDoctor.address}}</p>
</a>
.state('tabs.doctor', {
url: '/doctor/{doctorId}',
views: {
'tab-appts': {
templateUrl: 'templates/appts/doctors-this.html',
controller: 'ApptsCtrl as appt'
}
}
})
code
이 잘못 되었습니까? 나는 지금 몇 시간 동안이 일을 해왔다.
? '$ state.go ('tabs.doctor');를 실행하면 논리 흐름이 잘못되었습니다. 데이터 인수가 없으므로 ApptsCtrl의 새 인스턴스가 생성됩니다. – charlietfl
@charlietfl 통찰력 주셔서 감사합니다 – markhamknight