Angularjs-指令日期选取,修改css

Angularjs-指令日期选取,修改css,angularjs,twitter-bootstrap,angularjs-directive,datepicker,Angularjs,Twitter Bootstrap,Angularjs Directive,Datepicker,我使用此指令显示日期选择器: myApp.directive('jqdatepicker', function() { return { restrict: 'A', require: 'ngModel', link: function(scope, element, attrs, ngModelCtrl) { $(element).datepicker({ dateFormat: '

我使用此指令显示日期选择器:

myApp.directive('jqdatepicker', function() {
    return {
        restrict: 'A',
        require: 'ngModel',
        link: function(scope, element, attrs, ngModelCtrl) {
            $(element).datepicker({
                dateFormat: 'yy-mm-dd',

                onSelect: function(date) {
                    var ngModelName = this.attributes['ng-model'].value;

                    // if value for the specified ngModel is a property of 
                    // another object on the scope
                    if (ngModelName.indexOf(".") != -1) {
                        var objAttributes = ngModelName.split(".");
                        var lastAttribute = objAttributes.pop();
                        var partialObjString = objAttributes.join(".");
                        var partialObj = eval("scope." + partialObjString);

                        partialObj[lastAttribute] = date;
                    }
                    // if value for the specified ngModel is directly on the scope
                    else {
                        scope[ngModelName] = date;
                    }
                    scope.$apply();
                }
            });
        }
    };
我需要在模态对话框中显示它。因此,我需要修改css以更改z索引:

datepicker.dropdown-menu{
  z-index:9999
}
我不知道如何将这个css放入我的指令中。 如果有人能帮我


谢谢。

可以使用jQuery修改CSS,如下所示:

$(element).css('background','red');
就你而言:

$(element).find('.dropdown-menu').css('z-index','9999');

谢谢你的回答。当我用Chrome调试javascript/css开发工具时,我看到我的日历css是:element.style{display:block;top:141px;left:471.09375px;z-index:10;},似乎.下拉菜单不是我应该修改的。在我的指令中更改z-index的正确方法是什么?我试过$element.css'z-index','9999';但这是行不通的。这取决于你想要做更改的元素。例如,您可以尝试$element.find'div'.css'z-index'、'9999';在元素下的所有div上应用css。将“div”选择器更改为您要修改的内容。当我单击输入时,日历显示在我的模式后面。日历显示时生成的html代码为:。。。我尝试过你的解决方案,但z指数保持等于10。如果我在live中将其更改为9999,日历将完美显示,因此我非常确定z-index是要更改的css值。但我现在没能做到。