寻找实现方法
observableOne.SkipIf(observableTwoFiresWithinPeriod)
walkins Observable
)phoneWalkins Observable
)。nonPhoneWalkins Observable
)鉴于我有walkins
和phoneWalkins
子集可用作流,nonPhoneWalkins
应为walkins
,phoneWalkins
除外。
phoneWalkins
会在walkins
之后发出信号答案 0 :(得分:1)
这是我的简单尝试:
angular.module('appName').directive('profileedit',function(){
return{
restrict: 'E',
templateUrl: 'client/modules/profile-edit/profile-edit.html',
controllerAs: 'editProfileController',
controller: function($scope,$reactive){
$reactive(this).attach($scope);
this.helpers({
cropImgSrc: function(){
return ' ';
}
});
this.addAvatar = function(files){
if (files.length > 0) {
var reader = new FileReader();
reader.onload = function(e) {
$scope.$apply(function(){
this.cropImgSrc = e.target.result;
});
};
reader.readAsDataURL(files[0]);
}
else {
this.cropImgSrc = undefined;
}
};
}
}
答案 1 :(得分:1)
感谢@supertopi指出另一个相关问题,并且@LeeCampbell的答案移植到此上下文应该有效:
nonPhoneWalkins =
walkins.SelectMany
(walkin =>
phoneWalkins.Take(1).Select(phoneWalkin => false)
.Amb(
Observable.Timer(TimeSpan.FromSeconds(1)).Select(l => true)
)
)
.Where(nonPhoneWalkin => nonPhoneWalkin);