2015-09-24 110 views
1

我是全新使用Angular JS,所以如果這是一個基本問題,請原諒我。我在用Angular Schema Form添加日期選擇器時遇到問題(http://schemaform.io)我按照datepicker github頁面上的說明進行了操作,但我無法使用日期選擇器在我的頁面上顯示。這是我一直在使用的代碼片段。任何人都可以幫助或建議我犯過的錯誤嗎?角度架構形式datepicker

<!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)"> 
 
\t </form> 
 
\t 
 
\t <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> 
 
\t 
 
\t 
 
\t 
 
\t </div> 
 

 
    </body>

+0

莫非pickadate的版本? 「pickadate.js-master」是直接的master分支嗎?爲什麼不是普通的涼亭包? – davidlgj

回答