Skip to content

sw-broadcast expression cant use && or ||? #12

@einsitang

Description

@einsitang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions