<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css"> <link rel="stylesheet" href="node_modules/angular-bootstrap-datetimepicker/src/css/datetimepicker.css"/> </head> <body ng-app="MyApp"> <p>{{mode}}</p> <datetimepicker data-ng-model="mode"></datetimepicker> </body> <script type="text/javascript" src="node_modules/moment/moment.js"></script> <script type="text/javascript" src="node_modules/angular/angular.js"></script> <script type="text/javascript" src="node_modules/angular-bootstrap-datetimepicker/src/js/datetimepicker.js"></script> <script type="text/javascript" src="node_modules/angular-bootstrap-datetimepicker/src/js/datetimepicker.templates.js"></script> <script type="text/javascript" src="locales/bootstrap-datetimepicker.zh-CN.js"></script> <script>var myAppModule = angular.module('MyApp', ['ui.bootstrap.datetimepicker'])</script> </html>
package.json
{ "name": "cynthia", "version": "1.0.0", "description": "", "main": "index.js", "scripts": {"test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": {"angular-bootstrap-datetimepicker": "^1.1.4","bootstrap": "^3.3.7" } }
#把以上兩個檔案放到同一目錄
npm install
運行index.html文件就可以看到效果了。
如果出現: TypeError: Cannot set property '$render' of undefined
##說明說明angular的版本太低,這個版本要求至少在v1.2.30以上.github傳送門:#
以上是angular bootstrap中出現錯誤怎麼辦?的詳細內容。更多資訊請關注PHP中文網其他相關文章!