I am having radio buttons in angularjs. I am using ICheck directive for the setting the styles for the checkbox and radio button. The radio button is not checked on Edit of particular row. This is Icheck directive:
adminApp.directive('icheck', ['$timeout', '$parse', function ($timeout, $parse) {
return {
link: function($scope, element, $attrs) {
return $timeout(function() {
var ngModelGetter, value;
ngModelGetter = $parse($attrs['ngModel']);
value = $parse($attrs['ngValue'])($scope);
return $(element).iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal-blue',
checkboxClass: 'icheckbox_minimal-blue',
increaseArea: '20%'
}).on('ifChanged', function(event) {
if ($(element).attr('type') === 'checkbox' && $attrs['ngModel']) {
$scope.$apply(function() {
return ngModelGetter.assign($scope, event.target.checked);
});
}
if ($(element).attr('type') === 'radio' && $attrs['ngModel']) {
return $scope.$apply(function() {
return ngModelGetter.assign($scope, value);
});
}
});
});
}
};
}])
My html code for radio button is
<label class="radio-inline"><input type="radio" name="blogColumnType" icheck ng-model="blog.createBlog.BlogColumnTypeId" ng-value="1"> Single Column</label>
<label class="radio-inline"><input type="radio" name="blogColumnType" icheck ng-model="blog.createBlog.BlogColumnTypeId" ng-value="2"> Double column</label>
blog.createBlog.BlogColumnTypeId
is my scope variable.
Kindly help me to fix this. Thanks in advance.