Skip to content

Instantly share code, notes, and snippets.

@julienroubieu
Last active March 2, 2016 20:53
Show Gist options
  • Save julienroubieu/50fc80f2950919136f71 to your computer and use it in GitHub Desktop.
Save julienroubieu/50fc80f2950919136f71 to your computer and use it in GitHub Desktop.
Fix for $ionicListDelegate not working in modals
#
# The original Ionic $ionicListDelegate does not work for views in modals.
# This decorator fixes the issue by getting the handle globally instead of from the active scope.
# https://github.com/driftyco/ionic/issues/2754
#
$ionicListDelegateDecorator = ($provide) ->
decorateService = ($delegate) ->
$delegate.$getByHandle = (name) ->
instances = this._instances
_.where(instances, '$$delegateHandle': name)[0]
$delegate
decorateService.$inject = ['$delegate']
$provide.decorator '$ionicListDelegate', decorateService
$ionicListDelegateDecorator.$inject = ['$provide']
angular
.module('jroubieu')
.config($ionicListDelegateDecorator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment