开发者

Manual Subscriptions not being called

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜