0

I have a simple directive that wraps the iCheck library method call for input elements:

export class iCheck implements ng.IDirective
{
    restrict: string;
    replace: boolean;
    transclude: boolean;

    constructor()
    {            
        this.transclude = false;
        this.replace = true;
        this.restrict = "A";            
    }

    link(scope: any, element: JQuery, attributes: ng.IAttributes)
    {            
        var Checkbox: any = element;

        Checkbox.addClass("i-checks");

        Checkbox.iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    }
}

This directive does not have any template associated with it. In the view I simply add this directive as an attribute to an input:

<input icheck type="radio" name="Test" ng-value="1" ng-model="Controller.Test" />

This works in terms of the iCheck, however, when I do this, the ng-model binding does not work. If I remove the iCheck attribute, it works fine. Any ideas?

Walter
  • 664
  • 1
  • 6
  • 19
  • See [SO Answer: `replace = true` is deprecated](http://stackoverflow.com/questions/22497706/angular-directive-replace-true/35519198#35519198) – georgeawg Dec 02 '16 at 08:20
  • See also [icheck issue #62 -- Angular Directive](https://github.com/fronteed/icheck/issues/62) – georgeawg Dec 02 '16 at 10:18

0 Answers0