I haven't usex rxjs, so this may not be right, but I'm going to assume that the .subscribe()
function sets a callback for some time in the future, so the console.log(this.total)
runs before it's actually updated from the subscription thing.
Are you sure you want to be subscribing in a callback, and not during the class creation?