vitalets/checklist-model — dự án mã nguồn mở — đang có 1.1k sao GitHub. AngularJS directive for list of checkboxes
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
In Angular one checkbox <input type="checkbox" ng-model="..."> is linked
with one model.
But in practice we usually want one model to store array of checked values
from several checkboxes. Checklist-model solves that task without additional code in controller.
Live demo
http://vitalets.github.io/checklist-model
Installation
Note: since version 1.0.0 you must install the angular library yourself as it is now a peerDependency
Download package:
From npm npm install checklist-model
From bower bower install checklist-model
From latest release
Include script to the HTML:
<script src='checklist-model.js'></script>
Add to app dependencies:
var app = angular.module("app", ["checklist-model"]);
Usage
You should play with attributes of <input> tag:
Attribute
Mandatory
Description
checklist-model
Yes
Use instead of ng-model
checklist-value
No
What should be picked as array item
value
No
What should be picked as item, but unlike checklist-value, this does not evaluate as an angular expression, but rather a static value
ng-model
No
Every checkbok will span a new scope and define a variable named checked to hold its state. You can modify this name by using this attribute.
checklist-comparator
No
A custom comparator. If it starts with dot(.) then it will be an expression applied to the array item. Otherwise it should evaluate to a function as an angular expression. The function return true if the first two arguments are equal and false otherwise.
checklist-before-change
No
An angular expression evaluated each time before the checklist-model has changed. If it evaluates to 'false' then the model will not change anymore.
checklist-change
No
An angular expression evaluated each time the checklist-model has changed.
If you modify directly the value of the checklist-model, it is possible that the UI won't be updated. This is because this directive looks for the model in the parent, not in the current scope. Instead of doing checklistModelList = [] you should do checklistModelList.splice(0, checklistModelList.length) or wrap it in another object. Consequently, instead of doing checklistModelList = angular.copy(allValues) you should do checklistModelList.push.apply(checklistModelList, allValues). The idea is to use the same array and not replace it with a new one.
If you're using track by you must specify the same thing for checklist-value too. See #46.
If you're also using ngModel, please keep in mind that the state of the checkbok is initialized with the value from checklistModel, not with the one from ngModel. Afterwards the two will be kept in sync, but initially, these two can be conflicting, so only checklistModel is used. See the entire discussion at #104.
Examples
JsFiddle basic example (use this to report any issue): http://jsfiddle.net/beradrian/fjoLy5sq/
Ask a question on StackOverflow and tag it with checklist-model.
Fill in an issue.
Please keep in mind to also add a Plunkr or JSFiddle example. This will greatly help us in assisting you and you can use one of the existing examples and fork it.
Development
How to run tests
Generate live demo index.html via grunt jade
Run local http server grunt server
Open in browser http://localhost:8000 to check that demo is accessible
Open in browser http://localhost:8000/test and wait until all tests pass
How to add a new test case
Create a new folder under docs/blocks named your-test.
Create under that folder ctrl.js to describe the test Angular controller, view.html to describe the view part in HTML and test.js for the Angular scenario test. You can use an existing test as an example.
Add a line like - items.push({id: 'your-test', text: 'Your test, ctrlName: 'CtrlTestName', testValue: 'selectedItems'}) to docs/index.jade
Add a line like <script src="../docs/blocks/your-test/test.js"></script> to test\index.html
Run grunt jade to generate index.html from docs/index.jade
Run grunt server
Access http://localhost:8000 for samples and http://localhost:8000/test for running the tests.
How to make a new release
Change the version number in package.json, bower.json and checklist-model.nuspec (if not already changed - check the version number against the latest release in Github)
Create a new release in github with the same name for tag and title as the version number (e.g. 1.0.0). Do not forget to include the changelog in the release description.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/vitalets/checklist-model là nguồn chính thức.
vitalets/checklist-model có bao nhiêu sao?
vitalets/checklist-model có 1.1k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/vitalets/checklist-model. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
vitalets/checklist-model có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho vitalets/checklist-model. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
vitalets/checklist-model có trang demo không?
Dự án có trang chủ ở http://vitalets.github.io/checklist-model. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
vitalets/checklist-model còn đang phát triển không?
Commit gần nhất trên vitalets/checklist-model là 8.4 năm trước (theo timestamp GitHub). Repo có 203 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
vitalets/checklist-model dùng license gì?
vitalets/checklist-model phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
vitalets/checklist-model viết bằng ngôn ngữ gì?
vitalets/checklist-model chủ yếu viết bằng HTML. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc checklist-model có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về checklist-model.