Skip to content

Instantly share code, notes, and snippets.

@Thanood
Last active April 1, 2016 09:44
Show Gist options
  • Save Thanood/8e0ece3181508123e1ac to your computer and use it in GitHub Desktop.
Save Thanood/8e0ece3181508123e1ac to your computer and use it in GitHub Desktop.
observer-locator.js
import { ObserverLocator } from 'aurelia-binding';
import { inject } from 'aurelia-dependency-injection';
@inject(ObserverLocator)
export class App {
constructor(observerLocator) {
this.subscription = observerLocator.getObserver(this, 'selectedValue');
this.subscription.subscribe(this.selectedValueChanged);
}
detached() {
this.subscription.unsubscribe();
}
selectedValue = '';
selectedValueChanged(newValue) {
console.log('select changed', newValue);
}
setSelectedValue() {
this.selectedValue = 'ny2';
}
}
@Thanood
Copy link
Author

Thanood commented Apr 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment