2

我是使用 Angular JS 的新手,如果这是一个基本问题,请原谅我。我在使用带有 Angular Schema Form ( http://schemaform.io ) 的日期选择器时遇到问题 我已按照 datepicker github 页面上的说明进行操作,但我根本无法在我的页面上显示日期选择器. 这是我一直在使用的代码片段。任何人都可以帮助或建议我犯的任何错误吗?

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Unilever Data Centre Site Survey</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css" />
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script type="text/javascript" src="bower_components/tv4/tv4.js"></script>
<script type="text/javascript" src="bower_components/objectpath/lib/ObjectPath.js"></script>
<script type="text/javascript" src="bower_components/angular-schema-form/dist/schema-form.min.js"></script>
<script type="text/javascript" src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
<script type="text/javascript" src="bower_components/datepicker/bootstrap-datepicker.min.js"></script>
<script type="text/jscript" src="bower_components/jquery-2.1.4.min.js"></script>
<script type="text/jscript" src="bower_components/pickadate.js-master/lib/picker.js"></script>
<script type="text/jscript" src="bower_components/pickadate.js-master/lib/picker.date.js"></script>
<link rel="stylesheet" href="bower_components/pickadate.js-master/lib/themes/default.css"> </link>
<link rel="stylesheet" href="bower_components/pickadate.js-master/lib/themes/default.date.css"> </link>
</head>


 <body ng-app="test" ng-controller="TestCtrl">
   
 <nav class="navbar navbar-default"> </nav>
  <div style="width:950px;" class="container-fluid">
   
    <div ng-controller="TestCtrl">
    <form name="test" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit(test,modelData)">
	</form>
	
	 <h3>Model</h3>
     <div>{{prettyModel}}</div>



<script>
angular.module('test',['schemaForm']).controller('TestCtrl', function($scope,$http){
  
  
  
   $scope.schema = {
  "type": "object",
  "properties": {
  
  
  "birthDate": {
      "title": "Bday",
      "type": "string",
      "format": "date"
    },
    
    
    
   $scope.form = [ 
   
{
    "key": "birthDate",
    "minDate": "1995-09-01",
    "maxDate": new Date(),
    "format": "yyyy-mm-dd"
  },​
     
     
     $scope.model = {};
  
   $scope.$watch('model', function(value){
            if (value) {
              $scope.prettyModel = JSON.stringify(value, undefined, 2);
            }
          }, true);


  
  
})
    </script>
	
	
	
	</div>

  </body>

4

1 回答 1

2

它不起作用,因为缺少 Textalk/angular-schema-form-datepicker。

您需要安装 angular-schema-form-datepicker

https://github.com/Textalk/angular-schema-form-datepicker

于 2015-09-29T20:50:09.853 回答