首頁 >web前端 >js教程 >分享angular bootstrap timepicker TypeError提示該如何解決

分享angular bootstrap timepicker TypeError提示該如何解決

零下一度
零下一度原創
2017-06-15 13:28:171335瀏覽

這篇文章主要介紹了angular bootstrap timepicker TypeError提示的解決方法,具有一定的參考價值,有興趣的小伙伴們可以參考一下

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(&#39;MyApp&#39;, [&#39;ui.bootstrap.datetimepicker&#39;])
  </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以上.

以上是分享angular bootstrap timepicker TypeError提示該如何解決的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn