0
저장소와 라우터가 모두 필요한 Ember 구성 요소가 있습니다. Ember.inject.service
을 사용하여 주입하려고합니다. 상점을 삽입 할 때 작동하지만 라우터는 작동하지 않습니다.Ember 종속성 주입이 Ember 1.11의 라우터와 작동하지 않습니다.
import Ember from 'ember';
const MyComponent = Ember.Component.extend({
store: Ember.inject.service('store'),
routing: Ember.inject.service('-routing'),
classNames: ['my-component'],
schema: Ember.computed('store', 'routing', function schema() {
// This works. Shows up when I log it.
const store = this.get('store');
// This doesn't
const routing = this.get('routing');
// return schema from store. This works.
}),
});
export default MyComponent
Ember 버전 1.11.3입니다. 내가 놓친 게 있니?
패키지에이 점이 있는지 확인 했습니까? 'ember-routing/lib/services/routing.js' 파일을 놓친 것일 수도 있습니다. 또한 오류가 있습니까? 그리고 예를 들어 이니셜 라이저에서 주입하려고 했습니까? – reillyethan
@reillyethan : 어떤 패키지가 있습니까? 엠버 건물 자체에서? 오류 없음. 현재 구성 요소 초기화를 주입 중입니다. – BarFooBar
라우팅 서비스가 올바르게 설치되지 않았거나 이해가되지 않을 수도 있습니다. 글쎄, 왜 작동하지 않는지 모르겠다. 문서 도구에서는이 서비스가 비공개이지만 열 수 있다고합니다. 나는 이것들이 무엇을 의미하는지 모르겠다. [here] (https://github.com/emberjs/ember.js/blob/v2.7.0/packages/ember-routing/lib/services/) 주석을 볼 수있다. routing.js # L13) 어쩌면 상점이나 상점처럼 열리지 않았을 수도 있습니다 – reillyethan