0
나는 아마도 간단한 문제가 있습니다. 이전에 Angular에서 서비스로 작업했지만 MEANJS Yeoman Generator 프로젝트를 사용하여 문제가 발생했습니다. 내가 필요로하는 것은 다른 모듈의 특정 모듈에있는 배열의 데이터를 사용하는 것입니다. 그래서 다른 모델의 뷰 내에서 이것을 반복 할 수 있습니다.MEANJS에서 각도 서비스 사용하기 0.4.2
정확히 어디서 서비스의 배열을 가져 옵니까?
(function() {
'use strict';
angular
.module('patients')
.factory('PatientsService', PatientsService);
PatientsService.$inject = ['$resource'];
function PatientsService($resource) {
return $resource('api/patients/:patientId', {
patientId: '@_id'
}, {
update: {
method: 'PUT'
}
});
}
})();
나는 (단지 다른 서비스 구조를 가진 오래된 MEANJS 버전에서)도 여기에 지금까지 MEANJS 문서 내부에 아무것도를 찾을 수 없습니다. 여기
내가 서비스 내부에 가지고 싶은 것이 있습니다 :
// Shows a List of useable avatars on Patient creation
$scope.avatars = [
{ value:'1', name: 'modules/patients/client/img/avatar/avatar1.png' },
{ value:'2', name: 'modules/patients/client/img/avatar/avatar2.png' },
{ value:'3', name: 'modules/patients/client/img/avatar/avatar3.png' },
{ value:'4', name: 'modules/patients/client/img/avatar/avatar4.png' },
{ value:'5', name: 'modules/patients/client/img/avatar/avatar5.png' },
{ value:'6', name: 'modules/patients/client/img/avatar/avatar6.png' }
];
내가 PatientsService 이미 home.client 컨트롤러 내부에 주입보기 home.client의 아바타를 사용하고 싶습니다.
아, 내가 볼이 참으로 간단하지만 난 그것을 COMPLET 길을 잘못 했어요! 고마워요. – d8ta
앱 전체에서 $ 리소스를 사용하기 위해 다른 것을 바꿀 필요가 있는지 아시나요? 그것은 더 이상 사용할 수 없습니다 보인다?! – d8ta
나 혼자있어. 둘 다 함께 사용할 수 있다고 생각합니다. 객체와 리소스로서의 아바타는 객체와 동일한 위치에 있습니다. – d8ta