选中编辑复选框时 [英] When edit check box checked
本文介绍了选中编辑复选框时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有重复复选框。我希望在编辑时选中此复选框。
< ul style =position:relative; top:60px; >
< li ng-repeat =在learningpath.learningassests中指派学习路径>
< input type =checkboxng-checked =assignLearningpath.idng-model =assignLearningpath.selectedvalue = {{assignLearningpath.name}} ng-change ='trackOrder(assignLearningpath)'/ > {{assignLearningpath.name}}
< / li>
< / ul>
引用:和我的控制器在编辑时获取数据
{id:48,company_id:2,name:wr4t,description:,status:1,created_at:
00:00:00,updated_at:0000-00-00 00:00:00,learningAssest:2,3,route:topic / learningpath_edit /, reqParams:{lang:en-us},restangularized:true,fromServer:true,parentResource:null,restangularCollection:false}添加到路径
我尝试了什么:
当我编辑时我可以获得像
learningAssest:2,3
这是来自数据库的数据我要检查2和3复选框在这种情况下
解决方案
您必须使用2个bool变量扩展数据模型,这些变量读取并表示此值并将它们连接到XAML中。或者写一些处理程序,在这个教程中设置检查框。
I have check box in re-repeat.i want this check box checked when edit.
<ul style="position:relative;top:60px;"> <li ng-repeat="assignLearningpath in learningpath.learningassests"> <input type="checkbox" ng-checked="assignLearningpath.id" ng-model="assignLearningpath.selected" value={{assignLearningpath.name}} ng-change='trackOrder(assignLearningpath)' /> {{assignLearningpath.name}} </li> </ul>
Quote:and my controller when edit i get data like
{"id":48,"company_id":2,"name":"wr4t","description":"","status":"1","created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00","learningAssest":"2,3","route":"topic/learningpath_edit/","reqParams":{"lang":"en-us"},"restangularized":true,"fromServer":true,"parentResource":null,"restangularCollection":false} Add to Path
What I have tried:
when i edit i can get check box value like "
learningAssest":"2,3"
which is present in the data that is from database i want to checked 2 and 3 check box in this case
解决方案
You must extend your data model with 2 bool variables which reads and represents this values and connect them in the XAML. Or write some handler which setting the checkes on the boxes like in this tutorial.
这篇关于选中编辑复选框时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文