Sunday, February 3, 2013

jQuery many rules makes me embrace AngularJS more

Converting jQuery prop method to is method:

var isChecked = $('#ShowFaveNumbers').prop('checked');

Is not a mere changing of the method:

var isChecked = $('#ShowFaveNumbers').is('checked');


You have to remember some rules, must do this:

var isChecked = $('#ShowFaveNumbers').is(':checked');


In AngularJS, it's just a mere getting of model

var isChecked = $scope.ShowFaveNumbers;

No comments:

Post a Comment