sw-broadcast expression cant use && or ||?
I make a function like "load more end" , but when I first enter , that event("load more end") will trigger,this is my code :
let loadMoreEndDefer;
let loadMoreEndDeger;
//here is a real function for the app
$scope.$on('load more end', ($evt, n, locals) =>{
// For the "end" button
$log.debug('load more...');
return;
if(!loadMoreEndDefer){
loadMoreEndDefer = userListCtrl.loadMoreEnd(20);
loadMoreEndDefer['finally'](()=>{
loadMoreEndDefer = null;
})
}
});
//here is a test function for debug
$scope.$on('test',($evt, n, locals)=>{
$log.debug($evt,n,locals);
});
and my view setting like this :
scroll-watch="{from:0,to:-1,stage:'dialog'}"
sw-broadcast="{'load more end':'$progress ==1 && $positive!=-1','test':true}"
when I first enter,I see the console show this log:
load more... <- here is the 'load more end' event
{$positive: -1, $negative: -1, $progress: 1, $percentage: 100, $direction: 0…} <= here is the 'test' event
that mean
'load more end':'$progress ==1 && $positive!=-1' cant work ?
I try use and even & replace && , but will show me error stack
I try to change 'load more end':false,'test':true,but the load more end still trigger,look like there is no difference with the test
Hi @forfuns ,
I tried to recreate the result you described.
$positive: -1
http://plnkr.co/edit/KXFVv8VUUJOtJ4v2oW4X
This is caused by the page not having any scrollbar I guess.
Working demo of $progress == 1 && $positive != -1
http://plnkr.co/edit/uT9TW1wk0AfbmcZOquHB
(scroll down and filter the console output with @load1)
-
@load1log ofload more -
@load2log ofload more end