angular bootstrap timepicker TypeError提示怎么办

时间:2021-05-28

angular bootstrap timepicker TypeError: Cannot set property '$render' of undefined,如何解决?

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css" rel="external nofollow" > <link rel="stylesheet" href="node_modules/angular-bootstrap-datetimepicker/src/css/datetimepicker.css" rel="external nofollow" /></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传送门:https://github.com/raomojiuran/angular-bootstrap-datetimepicker

github:https://github.com/cynthiawupore

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章