{"id":18930849,"url":"https://github.com/onlymisaky/reviewform","last_synced_at":"2026-01-27T05:31:50.393Z","repository":{"id":122393812,"uuid":"93112713","full_name":"onlymisaky/reviewForm","owner":"onlymisaky","description":"checkbox, radio, select","archived":false,"fork":false,"pushed_at":"2017-06-02T10:31:35.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-25T02:44:43.862Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://onlymisaky.github.io/reviewForm/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onlymisaky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-02T01:01:54.000Z","updated_at":"2024-06-19T01:56:53.000Z","dependencies_parsed_at":"2024-07-09T14:16:23.479Z","dependency_job_id":null,"html_url":"https://github.com/onlymisaky/reviewForm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/onlymisaky/reviewForm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlymisaky%2FreviewForm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlymisaky%2FreviewForm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlymisaky%2FreviewForm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlymisaky%2FreviewForm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onlymisaky","download_url":"https://codeload.github.com/onlymisaky/reviewForm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onlymisaky%2FreviewForm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28803898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:44:14.111Z","status":"ssl_error","status_checked_at":"2026-01-27T03:43:33.507Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:39:10.505Z","updated_at":"2026-01-27T05:31:50.378Z","avatar_url":"https://github.com/onlymisaky.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"checkbox、radio、select复习\n\n[效果查看](https://onlymisaky.github.io/reviewForm/)\n\n[原生版Code](https://github.com/onlymisaky/reviewForm/blob/master/index.html)\n\n[jQuery版本Code](https://github.com/onlymisaky/reviewForm/blob/master/jQuery.html)\n\n[angular版本Code](https://github.com/onlymisaky/reviewForm/blob/master/angular.html)\n\n[angular不完美版本Code](https://github.com/onlymisaky/reviewForm/blob/master/angular2.html)\n\n\n\n\n其实我是想写成博客的，但是我发现。。。。。。。。。。。\n\n\n\n\n## 前言\n用`angular`已经快半年了，基本上都是在写`component`或者用别人写好的`component`，最近在写一个需要用到`checkbox`、`radio`、`select`这些表单的组件，发现对这些表单在`angular`中的运用还不是很熟练，或者说是理解不到位，所以就单独拿出来练习一下。\n## checkbox\n### 基础\n`checkbox`用`ng-model`绑定时，默认绑定的值是`Boolean`类型的。\n\n![image](http://i4.buimg.com/1949/a9431167786724e2.png)\n\n我们也可以用`ng-true-value`,`ng-false-value`为其指定选中时绑定的值，*注意 `ng-true-value`中的值如果需要显示字符串的话必须使用单引号*\n```html\n\u003cbody ng-app=\"app\" ng-controller=\"Ctrl as ctrl\"\u003e\n    \u003cinput type=\"checkbox\" \n           ng-model=\"ctrl.checked\" \n           ng-true-value=\"'选中'\"\n           ng-false-value=\"'取消选中'\"       \n           ng-change=\"ctrl.changeCheckbox()\"\u003echeckbox\n\u003c/body\u003e\n```\n```javascript\nangular\n    .module(\"app\", [])\n    .controller(\"Ctrl\", function () {\n        var vm = this;\n        vm.changeCheckbox = function () {\n            console.log(vm.checked);\n        }\n    });\n```\n![image](http://i4.buimg.com/1949/a4f4aa5b4b011b3b.png)\n### 进阶\n在实际开发中，我们常常会用到多个`checkbox`，这个时候就需要知道选中的哪些选项，还有全选反选这些操作。除了`angular.html`中所提供的方法，我们也可以使用`ng-true-value`\n\n\n\n\n\n\n\n\n好吧，我不适合写作。。。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlymisaky%2Freviewform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonlymisaky%2Freviewform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlymisaky%2Freviewform/lists"}