Filter testing

by fergal_doyle

HTML

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<div ng-app="app" id="ng-app" ng-controller="test">
    <div ng-repeat="item in list">
        <label>{{item.title}}
            <input type="checkbox" someplugin  ng-checked="item.checked">
        </label>
    </div>
</div>

JavaScript

var app = angular.module('app', []);

app.controller("test", function ($scope) {
    $scope.list = [{
        title: "A",
        checked: true
    }, {
        title: "B",
        checked: false
    }, {
        title: "C",
        checked: true
    }];
});

app.directive("someplugin", function ($timeout) {
    return {
        restrict: "A",
        link: function (scope, element, attrs) {
            
            // too soon
            console.log($(element).prop("checked"));
            
            // works
            $timeout(function(){
             console.log($(element).prop("checked"));
            },0);

        }
    };
});