Last active
September 8, 2015 10:54
-
-
Save rolaveric/3abce7410cb95da93446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyController { | |
// ... snip | |
viewValue(path) { | |
// getCache() returns a JSON fragment, so we need to parse the path | |
const value = this.$parse(path)(this.model.getCache(path)); | |
if (typeof value !== 'undefined') { | |
return typeof value === 'object' ? value.value : value; | |
} | |
// Cache miss - request the real value | |
this.model.getValue(path) | |
.subscribe(_ => this.$scope.$evalAsync()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment