-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service wont start unless I console log clock #7
Comments
Interesting. Does adding |
I have the same problem, adding a binding to |
manually calling |
I just ran into this and learned a bit about how service injection works. Hopefully this helps anyone else running into this issue... Services are lazily injected into Ember objects, so One way to make sure your clock service gets injected is to make your computed property accesses it. So, instead of writing... isAvailable: computed('availableDate', 'clock.date', function() {
return moment(this.availableDate).isAfter(new Date());
}) you should write something the accesses the clock, forcing injection to take place. For example: isAvailable: computed('availableDate', 'clock.date', function() {
- return moment(this.availableDate).isAfter(new Date());
+ return moment(this.availableDate).isAfter(this.clock.date);
}) |
So I am trying to inject the clock service in my model. But it will not start unless I interact with the clock service.
If I take out the console log the service will not start. Any ideas on what I am doing wrong?
The text was updated successfully, but these errors were encountered: