JSFiddle - React, Tailwind, and code Playground
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 () {
return {
restrict: "A",
link: function (scope, element, attrs) {
// undefined:
console.log($(element).prop("checked"));
// works
setTimeout(function(){
console.log($(element).prop("checked"));
},1);
}
};
});