Error: [$compile:ctreq] Controller '$ionicScroll', required by directive 'ionAffix',


#1

MyApp need to multiple sorted group list by date

And I want group-list header title can be sticky.
so, I add to useful plugins.

  1. ionAutoListDivider
  1. ionAffix

but occur error when compiling directive in directive
(ionAffix in ionAutoListDivider)

  • error

    Error: [$compile:ctreq] Controller ‘$ionicScroll’, required by directive ‘ionAffix’, can’t be found!
    http://errors.angularjs.org/1.3.13/$compile/ctreq?p0=%24ionicScroll&p1=ionAffix
    at REGEX_STRING_REGEXP (ionic.bundle.js:8699)
    at getControllers (ionic.bundle.js:16180)
    at nodeLinkFn (ionic.bundle.js:16369)
    at compositeLinkFn (ionic.bundle.js:15714)
    at publicLinkFn (ionic.bundle.js:15593)
    at newCompile (hint.js:2010)
    at link.doDivide (ionic-ion-autoListDivider.js:21)
    at ionic.bundle.js:24859
    at completeOutstandingRequest (ionic.bundle.js:13541)
    at ionic.bundle.js:13921

  • customized autoListDivider.js

angular.module(‘ionic.ion.autoListDivider’, [])

.directive('autoListDivider', function($compile, $timeout) {
    var lastDivideKey = "";

    return {
        link: function(scope, element, attrs) {
            var key = attrs.autoListDividerValue;
            var defaultDivideFunction = function(k){
                return k.slice( 0, 1 ).toUpperCase();
            };

            var doDivide = function(){
                var divideFunction = scope.$apply(attrs.autoListDividerFunction) || defaultDivideFunction;
                var divideKey = divideFunction(key);

                if(divideKey != lastDivideKey) {
                    var contentTr = angular.element("<div class='item item-divider'>"+divideKey+"</div>");
                    contentTr.attr('ion-affix','');
                    contentTr.attr('data-affix-within-parent-with-class','list');
                    $compile(contentTr)(scope); // !!! ERROR !!!
                    element[0].parentNode.insertBefore(contentTr[0], element[0]);
                }
                lastDivideKey = divideKey;
            };

            $timeout(doDivide,0);
        }
    }
});

Anybody Help me Please.