返回鏈式的承諾,這是取消 參見:http://jsbin.com/jeweke/2/
timer = $interval(intervalFunc, intervalDelay, 10);
timer.then(
function(res) {console.log('ok', res);},
function(err) {console.log('err', err);}
);
但是,如果我鏈中的承諾,返回的承諾是不可取消。 請參閱:http://jsbin.com/jeweke/1/
timer = $interval(intervalFunc, intervalDelay, 10)
.then(
function(res) {console.log('ok', res);},
function(err) {console.log('err', err);}
);
是怎麼回事?這是它應該如何工作?
注 - 這裏的例子是鬆散改編自http://jsfiddle.net/ExpertSystem/fZc3W/
很好的解釋。感謝您挖掘源代碼。 – RoyM 2014-10-21 22:52:39
@roymath不客氣...... :) – PSL 2014-10-21 22:53:32