简体   繁体   中英

Inject Ember.Controller model into Ember.Service

How can I access the "model" in an Ember.Controller from an Ember.Service ? In my case I need the ember-data model in a url such as http://localhost:4200/users/4/groups . In a route I can simply do this.modelFor('users')

You can not access the "model" in an Ember.Controller from an Ember.Service . You can only inject controller in another controller. You need to pass model data to Service method and get your work done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM