簡體   English   中英

AngularJS UI Datepicker與Bootstrap無法正常工作

[英]AngularJS UI Datepicker with Bootstrap not working

我正試圖讓一個日期選擇器與AngularJS一起工作。 我在我的項目中使用jQuery,jQueryUI,Bootstrap和AngularJS。 我嘗試了jQuery UI datepicker,但是使用Angular和它的范圍看起來效果不好(根本不是)。

我嘗試了很多東西,我的項目可能會變得混亂添加和刪除東西。 我見過許多有用的例子,我無法弄清楚我在項目中做錯了什么。 我是Angular的新手,這是我第一次在項目中使用它。

目前我正在嘗試使用我在這里找到的angular-ui / bootstrap datepicker: http//angular-ui.github.io/bootstrap/

以下順序包含在頭部中。 我遺漏了標簽以便更好地閱讀,我可以保證一切都裝得很好。

// CSS files
css/bootstrap-custom.min.css
css/myOwnStylesheet.css
css/jquery-ui.css

// JS files
js/jquery.js
js/jquery-ui.js
https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js
https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.2.15/angular-locale_nl-nl.js <- I need this for language specific things, like currency format

js/bootstrap.min.js
js/ui-bootstrap-custom-tpls-0.12.1.js <- I also tried without the tpls
js/myApp.js <- where I start my Angular app
js/ui-datepicker.js <- some code I copy pasted and edited from http://angular-ui.github.io/bootstrap/

我還會發布一些我的問題重要文件的內容。

myApp.js

var myApp = angular.module('myApp',['ui.bootstrap']);

ui-datepicker.js(已嘗試過一些變化)

angular.module('myApp').controller('DatepickerController', ['$scope', function ($scope) {
// … lots of stuff here, copy pasted from my source (http://angular-ui.github.io/bootstrap/) and not edited
}]);

UI的自舉定制TPLS-0.12.1.js

angular.module("ui.bootstrap", ["ui.bootstrap.tpls","ui.bootstrap.datepicker","ui.bootstrap.dateparser","ui.bootstrap.position"]);
angular.module("ui.bootstrap.tpls", ["template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html"]);
angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position'])
// … some other untouched code ...

現在對於HTML,我在html-tag中有一個ng-app =“myApp”。 一個工作控制器(如果我不添加以下ng-controller→)和一個ng-controller =“DatepickerController”,它給出以下錯誤:

參數'DatepickerController'不是函數,未定義

我希望有人可以告訴我我做錯了什么,我的項目取決於它!

我覺得你輸入代碼時迷路了,我不明白你為什么要添加tpls和其他模塊,檢查這個plunker,保持plunker簡單的鏈接

see the link

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM