cgarvis/angular-toggle-switch — pull request #5 by nathantsoi (2013-10-02 23:51:52+00:00)
Title: don't set any values on the model

readers shouldn't update data to avoid unwanted side effects

here's a concrete example where this is a problem: say we have a model: Car, that has Passengers, which get populated after someone selects a car in the UI

car.passengers should be null until the car is selected, but if a toggle-switch is created with the model set to car.passengers.some_switch, it will set car.passengers.some_switch to false. this sets car.passengers to an object of the wrong type and populates some_switch, breaking the null comparison