DEV: Add a widget API for injecting services (PR #13946)

When declaring your widget you can now add an option like: services: ['cool']

And your widget instances will automatically get a this.cool property which will resolve to the service. This saves having to look it up yourself.

GitHub

Looks good. I do wonder if the naming of the services will be a bit odd. Like for chat If I have

services: ["chat"],

Then in my widget, I’ll use this.chat rather than this.chatService

@markvanlan I kinda did that deliberately, because Ember wants you to do it that way. For example chat: service() resolves but chatService: service() does not unless you add ('chat') as a parameter.

In other words, the “Ember Way” is to not add the Service word to your member variable.