日期选择器在 AngularJS ng-template 脚本中不起作用



我使用弹出窗口来显示一些细节。我需要一个日期选择器,但脚本不起作用。

<div class="container" style="height:auto;">
<script type="text/ng-template" id="abc.html">
<div class="input-group date" id="datepicker">
<input class="form-control"  name="startDate" ng-model="startDate" name="startDate"></input>
<span class="input-group-addon" >
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</script>
</div>
<script type="text/javascript">
$(function() {
$('#datepicker').datepicker({
format:"dd-M-yyyy",
changeMonth: true,
changeYear: true,
buttonImage: "images/calendar.gif",
beforeShowDay: unavailable
});
});
</script>

我认为脚本标签中不应该有任何标签。并且应将日期纠察队添加到输入中。试试这个。

<div class="container" style="height:auto;">
<script type="text/ng-template" id="abc.html"></script>
<div class="input-group date" >
<input class="form-control" id="datepicker" name="startDate" ng-model="startDate" name="startDate"></input>
<span class="input-group-addon" >
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<script type="text/javascript">
$(function() {
$('#datepicker').datepicker({
format:"dd-M-yyyy",
changeMonth: true,
changeYear: true,
buttonImage: "images/calendar.gif",
beforeShowDay: unavailable
});
});
</script>

最新更新