开发者

Manual Subscriptions not being called

开发者 https://www.devze.com 2023-04-05 06:06 出处:网络
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?

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

精彩评论

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