If a dependent observable is changed in开发者_C百科 a manual subscription, shouldn't that change trigger any other subscriptions that are based on the observable?
In the example below, a change to the selectedGroupType
property changes the selectedTravellerCount
which should then cause the selectedTravellerCount
subscription to trigger. This doesnt happen though.
viewModel.selectedGroupType.subscribe(function(groupType) {
alert(groupType);
this.selectedTravellerCount = 10;
}, viewModel);
viewModel.selectedTravellerCount.subscribe(function(travellerCount) {
alert(this.travellerCount);
}, viewModel);
If selectedTravellerCount
is an observable, then you need to set the value like:
this.selectedTravellerCount(10);
精彩评论