I have the following code inside an angularjs application:
<div class="radio input-group-addon">
<label>
<input type="radio" name="radio1" value="foobar" ng-model="myModel" />
my label
</span>
</div>
The outer div has 100% background color. Now I want to make the entire area (the entire container of the container) available. I tried it with a handler ng-clickon a div like this:
<div class="radio input-group-addon" ng-click="selectRadio($event)">
<label>
<input type="radio" name="radio1" value="foobar" ng-model="myModel" />
my label
</span>
</div>
The method is selectRadio($event)as follows:
$scope.selectRadio = function($event) {
var radio = $(event.currentTarget).find("input[type='radio']");
radio.prop("checked", true);
radio.trigger("change");
}
Unfortunately, this does not cause a change on myModel. Is there a way to trigger the "change-bind-change" event (I don’t know how to designate this correctly) to update my switch model?
And besides, I was wondering if there is a more angular -way for this?
23tux source
share