angular-social icon indicating copy to clipboard operation
angular-social copied to clipboard

Error on link function angularjs 1.3.13

Open mastermind1981 opened this issue 9 years ago • 2 comments

Hi,

I got an error on link function of all directive : actually, the controller ctrl is passed but it does not reference the controller "controller" it's an empty shell. So when ctrl.init() is called in the link function i got on all link functions:

TypeError: undefined is not a function at link (http://localhost:3000/bower_components/angular-social/angular-social.src.js:341:18) Thanks in advance

mastermind1981 avatar Apr 05 '15 22:04 mastermind1981

I'm seeing this issue, too. I'm using Angular 1.3.15.

CWSpear avatar Apr 06 '15 03:04 CWSpear

Same for me, AngularJS 1.3.15

The issue seems to be that in the various scripts such as 02-facebook.js, 03-twitter.js, on the last line of the link function, it tries to call the ctrl.init function which is undefined.

For example in 02-facebook.js:

link: function(scope, element, attrs, ctrl) {
    element.addClass('ng-social-facebook');
    if (!ctrl) {
        return;
    }
    scope.options = options;
    scope.ctrl = ctrl;
    ctrl.init(scope, element, options);
}

It seems the controller passed in is not yet fully initialised when the link is called.

philiph avatar Apr 12 '15 23:04 philiph