All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.libs.checklistmodel.checklist-model.min.js Maven / Gradle / Ivy

angular.module("checklist-model",[]).directive("checklistModel",["$parse","$compile",function(e,t){function c(e,t,c){if(angular.isArray(e))for(var r=e.length;r--;)if(c(e[r],t))return!0;return!1}function r(r,a,i){t(a)(r);var l=e(i.checklistModel),n=l.assign,o=e(i.checklistChange),h=e(i.checklistValue)(r.$parent),u=angular.equals;function s(e,t){r.checked=c(e,h,u)}i.hasOwnProperty("checklistComparator")&&(u=e(i.checklistComparator)(r.$parent)),r.$watch("checked",function(e,t){if(e!==t){var a,i,s,p=l(r.$parent);n(r.$parent,!0===e?(a=p,i=h,s=u,c(a=angular.isArray(a)?a:[],i,s)||a.push(i),a):function(e,t,c){if(angular.isArray(e))for(var r=e.length;r--;)if(c(e[r],t)){e.splice(r,1);break}return e}(p,h,u)),o&&o(r)}}),angular.isFunction(r.$parent.$watchCollection)?r.$parent.$watchCollection(i.checklistModel,s):r.$parent.$watch(i.checklistModel,s,!0)}return{restrict:"A",priority:1e3,terminal:!0,scope:!0,compile:function(e,t){if("INPUT"!==e[0].tagName||"checkbox"!==t.type)throw'checklist-model should be applied to `input[type="checkbox"]`.';if(!t.checklistValue)throw"You should provide `checklist-value`.";return e.removeAttr("checklist-model"),e.attr("ng-model","checked"),r}}}]);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy