mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
Fixing filters selector directive to that an allSelector watcher isn't required for generation on selectors to work
This commit is contained in:
@@ -22,17 +22,11 @@ Darkswarm.directive "filterSelector", (FilterSelectorsService)->
|
||||
.map (selector)->
|
||||
selector.object.id
|
||||
|
||||
# This can be called from a parent scope
|
||||
# when data has been loaded, in order to pass
|
||||
# selectors up
|
||||
scope.$on 'loadFilterSelectors', ->
|
||||
scope.allSelectors = scope.selectors() if attr.allSelectors?
|
||||
|
||||
scope.$watchCollection "selectors()", (newValue, oldValue) ->
|
||||
scope.allSelectors = scope.selectors() if attr.allSelectors?
|
||||
scope.$watchCollection "objects()", (newValue, oldValue) ->
|
||||
scope.allSelectors = scope.buildSelectors()
|
||||
|
||||
# Build a list of selectors
|
||||
scope.selectors = ->
|
||||
scope.buildSelectors = ->
|
||||
# Generate a selector for each object.
|
||||
# NOTE: THESE ARE MEMOIZED to stop new selectors from being created constantly, otherwise function always returns non-identical results
|
||||
# This means the $digest cycle can never close and times out
|
||||
|
||||
Reference in New Issue
Block a user