SoFunction
Updated on 2025-04-08

Solve the problem of angularjs WdatePicker ng-model

Suppose we need to use WdatePicker and angularjs in our project, and we have the following code:

<div>
 <div class="h4">ddd</div>
 <input class="form-control" type="text" ng-model=""
 readonly="readonly" 
 onClick="WdatePicker({dateFmt:'yyyy',lang:'zh-cn'})"
 style="width: 400px; cursor: pointer;" />
 </div>

The problem with such code is that when you need to commit, you will find that $ has no value.

The solution is to add an onChange="", and the code becomes as follows:

<div>
 <div class="h4">ddd{{}}</div>
 <input class="form-control" type="text" ng-model=""
 readonly="readonly" onChange=""
 onClick="WdatePicker({dateFmt:'yyyy',lang:'zh-cn'})"
 style="width: 400px; cursor: pointer;" />
 </div>

Yes, just join this one. Of course, you may notice that there are some changes, ddd{{}}, the reason I wrote this is to solve a doubt. The doubt is that after you add onChange="", even if you select the date, {{}} cannot get the value, and if you output $, it is still undefined. At this time, you may think that onChange="" is invalid. But, it is not the case. When you submit the data, you will find that it is indeed submitted.

The above article solves the problem of angularjs WdatePicker ng-model is all the content I share with you. I hope you can give you a reference and I hope you can support me more.