我与Firefox存在兼容性问题。我已经有一个正在使用的Angular应用程序用于制作,但日期输入仅适用于Chrome。我忽略了这一点,现在我在Firefox和IE中运行时有一个破坏的应用程序。
我不想查看AngularJS-Bootstrap Datepicker路由,因为:
这是我到目前为止所做的事情:
这是我的代码:
<input type="text" id="bdate" name="bdate" ng-class="{'has-error': $submitted && signup.bdate.$invalid}" ng-model="formData.bdate" required class="form-control" placeholder="Birthday mm/dd/yyyy">
它有这样的验证:
<li ng-show="signup.bdate.$error.date"><p>Please enter a valid birth date.</p></li>
这是我的app.js:
var spinnrApp = angular.module('spinnrApp', ['ngAnimate', 'ui.router', 'slick', 'ngMessages']);
spinnrApp.config(function ($stateProvider, $urlRouterProvider) {
//
// Now set up the states
$stateProvider
.state('registration', {
url: "/registration",
templateUrl: "app/components/registration/registration.php",
controller: "FormController"
})
.state('registration.spinnrapp', { // nested state for the registration form
url: "/spinnrapp", // url will be nested /registration/artist
templateUrl: "app/components/registration/partials/registration-profile.php"
})
.state('registration.artist', { // nested state for the registration form
url: "/artist", // url will be nested /registration/artist
templateUrl: "app/components/registration/partials/registration-artist.php"
})
.state('registration.share', { // each nested state will have their own view
url: "/share", // url will be nested /registration/share
templateUrl: "app/components/registration/partials/registration-share.php"
});
//
// For any unmatched url, redirect to /
$urlRouterProvider.otherwise("/registration/spinnrapp");
});
spinnrApp.controller('FormController', ['$scope', '$http', '$state', function (scope, http, state){
// get list of cities and store it to select
http.get('cities.json').success(function(data){
scope.cities = data;
})
// we will store all our form data in this object
scope.formData = {};
// function to process the form
scope.processForm = function(isValid) {
scope.$submitted = true;
if(isValid && state.$current=='registration.spinnrapp') {
state.go('registration.artist');
} else if(isValid && state.$current=='registration.artist') {
state.go('registration.share');
} else if(!isValid && state.$current=='registration.artist') {
alert('Please make sure you have selected an artist.');
}
};
}]);
以下是我的主要问题:
最后,以下是我的所有脚本,以防你想知道如何将它们放在一起(index.php):
<script src="app/angular/jquery/dist/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.min.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="assets/js/bootstrap/tab.js"></script>
<script src="app/angular/angular/angular.min.js"></script>
<script src="app/angular/angular-ui-router/release/angular-ui-router.min.js"></script>
<script src="https://code.angularjs.org/1.3.0/angular-animate.min.js"></script>
<script src="https://code.angularjs.org/1.3.0/angular-resource.min.js"></script>
<script src="app/angular/angular-messages/angular-messages.min.js"></script>
<script src="app/angular/slick-carousel/slick/slick.min.js"></script>
<script src="app/angular/angular-slick/dist/slick.min.js"></script>
<script src="app/app.js"></script>
<script>
$(document).ready(function() {
$("#bdate").datepicker();
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = this.href.split('#');
$('.nav a').filter('[href="#'+target[1]+'"]').tab('show');
});
});
</script>
答案 0 :(得分:0)
您的输入ID为“bdate”更改$(“#datepicker”)。datepicker();到$(“#bdate”)。datepicker();