I'm trying to use the prettyCheckbox plugin to apply styling to my checkboxes. For those of you who don't know the plugin works the way that it hides the original checkbox and displays another styled object instead. I created a directive which instantiates the plugin for each checkbox.
The plugin on click of the fake checkbox sets the property of the real input element and calls change - this however doesn't seem to update the model:
input.prop('checked', true).change();
I amended the prettyCheckbox plugin slightly, so the original checkbox is being changed using a click event in order to update the model:
input.trigger('click');
This works fine, however the checkbox seems to always have the exact opposite value you would expect it to have: true if checkbox isn't checked and false if checkbox is checked. I can't seem to work out why this is happening. I created a plunkr to show you what is happening:
http://plnkr.co/edit/YVq2is0khGgLRWbHk2aB?p=preview
Thanks in advance for any helping hand :)