AngularStrap datepicker看起来很奇怪

时间:2014-03-15 20:24:38

标签: css angularjs angular-strap bootstrap-datepicker

我按照AngularDart getting started guide上的说明尝试在项目中使用AngularStrap datepicker 功能很好,但看起来很不错。 即使没有我自己的样式表加载,外观也不应该是它应该是什么。 这两个截图应该澄清问题:

应该如何看待:

how it should look

它实际上看起来如何:

enter image description here

该应用程序是用yeoman.io搭建的。

bower.json配置:

{
  "name": "myapp",
  "version": "0.0.0",
  "dependencies": {
    "angular": "~1.2.14",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0",
    "jquery": "~1.10.2",
    "bootstrap": "~3.1.0",
    "angular-resource": "1.2.14",
    "angular-cookies": "1.2.14",
    "angular-sanitize": "1.2.14",
    "angular-route": "1.2.14",
    "moment": "~2.5.1",
    "angular-strap": "~2.0.0",
    "angular-motion": "~0.3.2",
    "angular-animate": "~1.2.14"
  },
  "devDependencies": {
    "angular-mocks": "1.2.14",
    "angular-scenario": "1.2.14"
  },
  "resolutions": {
    "angular": "1.2.14"
  }
}

相关的index.html代码段:

<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/angular-motion/dist/angular-motion.min.css" />
...
<link rel="stylesheet" href="styles/style.css"/>
....
<script src="bower_components/es5-shim/es5-shim.js"></script>
<script src="bower_components/json3/lib/json3.min.js"></script>

<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/angular-strap/dist/angular-strap.min.js"></script>
<script src="bower_components/angular-strap/dist/angular-strap.tpl.min.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>

html中的datepicker输入标记:

<input type="text" class="form-control" ng-model="selectedDate" name="date" data-date-format="dd-MM-yyyy" data-start-view="2" bs-datepicker>

1 个答案:

答案 0 :(得分:17)

您需要添加以下样式:

.datepicker.dropdown-menu {
  width: 250px;
  height: 250px;
  button {
    outline: none;
    border: 0px;
  }
  tbody {
    height: 180px;
  }
  tbody button {
    padding: 6px;
  }
  &.datepicker-mode-1, &.datepicker-mode-2 {
    tbody button {
      height: 65px;
    }
  }
}

.timepicker.dropdown-menu {
  padding: 0 4px;
  button {
    outline: none;
    border: 0px;
  }
  tbody button {
    padding: 6px;
  }
}

请注意,这种格式较少/ sass格式。如果您需要直接css,请先转换here

这是一个角度带问题,其中mgcrea提供了所需的css:https://github.com/mgcrea/angular-strap/issues/398

基本上,你只需要删除按钮边框和轮廓并添加一些间距,它就像在角度带页面上一样。