Skip to content

Instantly share code, notes, and snippets.

@julienroubieu
Last active March 2, 2016 20:52
Show Gist options
  • Save julienroubieu/c676946019581d44ec7c to your computer and use it in GitHub Desktop.
Save julienroubieu/c676946019581d44ec7c to your computer and use it in GitHub Desktop.
Fix for $ionicScrollDelegate not working in modals
#
# The original Ionic $ionicScrollDelegate 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
#
$ionicScrollDelegateDecorator = ($provide) ->
decorateService = ($delegate) ->
$delegate.$getByHandle = (name) ->
instances = this._instances
_.where(instances, '$$delegateHandle': name)[0]
$delegate
decorateService.$inject = ['$delegate']
$provide.decorator '$ionicScrollDelegate', decorateService
$ionicScrollDelegateDecorator.$inject = ['$provide']
angular
.module('jroubieu')
.config($ionicScrollDelegateDecorator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment