我需要我的用户能够在输入字段中选择特定的日期时间.
我想使用angular-ui-bootstrap库,因为它避免了Jquery的依赖性.问题是,即使它包含一个日期选择器和一个时间戳,似乎也不可能将它们放在一个布局很好的弹出窗口中.
我发现了一个组件,它完全符合我对angular-ui-bootstrap的要求:http: //www.malot.fr/bootstrap-datetimepicker/demo.php
问题是它使用了Jquery,我们需要包含大量的javascript文件,这使得页面有点重,只是为了满足这个需求...
我在angular-ui-bootstrap github repo中进行了调查,发现这个问题包含了一个可以解决部分问题的plunker示例,但是这个例子没有选择时间的可能性.
有谁知道目前是否可以使用angular-ui-bootstrap datepicker和timepicker来选择日期时间?
所以我似乎无法弄清楚如何使用typeahead-loading属性来显示一个微调器,而我的预先输入远程数据.我无法在任何地方找到任何使用它的例子.
当我们开始请求时,我们需要在范围内手动设置该值吗?然后在请求完成时手动将其设置为false?有时候这些有角度的东西会有魔力,我不知道后端是否会发生额外的事情来处理这些事情.
只是一个如何在typeahead-loading中使用该值的简单示例.我只是想不出如何正确使用它.当然,许多角度文档缺少一些更复杂功能的好例子.
javascript angularjs angular-ui-bootstrap angular-ui-typeahead
我正在使用angular-bootstrap模态,但我有模态背景的问题.我是新手angular-bootstrap,我希望有人能帮助我.
当我点击模态背景时,它隐藏了模态弹出窗口,但我想保留模态背景,直到单击取消.
任何人请为此建议解决方案.
谢谢
我在我的一些页面上使用了ng-include,但是我不得不停止使用ng-include,因为它打破了angular-ui datepicker.我打开了这个Github错误.
我想知道是否有其他人在使用作为ng-include的一部分时,指令不能以相同的方式运行.
是否有办法使日期选择器作为ng-include的一部分按预期工作?
这是一个展示它是如何破碎的掠夺者.http://plnkr.co/edit/AboEJGxAK3Uz76CfpaZ0?p=preview
这是在视图上工作的html,但在部分ng包含时不起作用.
<div class="row">
<div class="col-md-2">
<p class="input-group">
<input type="text" class="form-control" datepicker-popup="yyyy/MM/dd" ng-model="something.dt2" is-open="secondCal"
min-date="minDate" name="secondCal" max-date="'2015-06-22'" datepicker-options="dateOptions"
date-disabled="disabled(date, mode)" ng-required="true" close-text="Close"/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" style="line-height: 1.2em" ng-click="open($event, 'secondCal')">
<i class="ss-icon ss-calendar"></i>
</button>
</span>
</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是来自控制器的JS.
$scope.open = function ($event, elementOpened) {
$event.preventDefault();
$event.stopPropagation();
$scope[elementOpened] = !$scope[elementOpened];
};
Run Code Online (Sandbox Code Playgroud)
我正在做两种方式 - 包括
<div ng-include src="'dist/partials/myPartial.html'"></div>
<div ng-include="'dist/partials/myPartial.html'"></div>
Run Code Online (Sandbox Code Playgroud)
更新 我发现这是因为ng-include指令为每个include创建了一个新的作用域. 这个SO帖子创建了一个新的指令,它可以在不创建新范围的情况下完成包含.然而,似乎"应该"是一种方法来修复它而不使用不同的包含.
使用ng-include设置包含动态内容的tabset时遇到问题.我尝试使用ng-repeat失败:
<tabset justified="true">
<tab ng-repeat="tab in tabs" heading="{{ tab.heading }}" active="tab.active">
<div ng-include="tab.template"></div>
</tab>
</tabset>
Run Code Online (Sandbox Code Playgroud)
另外,我试过没有ng-repeat:
<tabset justified="true">
<tab heading="{{ tabs.1.heading }}" active="tabs.1.active">
<div ng-include="'partial/profile/template1.html'"></div>
</tab>
<tab heading="{{ tabs.2.heading }}" active="tabs.2.active">
<div ng-include="'partial/profile/template2.html'"></div>
</tab>
<tab heading="{{ tabs.3.heading }}" active="tabs.3.active">
<div ng-include="'partial/profile/template3.html'"></div>
</tab>
<tab heading="{{ tabs.4.heading }}" active="tabs.4.active">
<div ng-include="'partial/profile/template4.html'"></div>
</tab>
<tab heading="{{ tabs.5.heading }}" active="tabs.5.active">
<div ng-include="'partial/profile/template5.html'"></div>
</tab>
</tabset>
Run Code Online (Sandbox Code Playgroud)
然而,我得到的是一个空白的页面,没有响应和那些错误:
WARNING: Tried to load angular more than once.
Run Code Online (Sandbox Code Playgroud)
和
10 $digest() iterations reached. Aborting!
Run Code Online (Sandbox Code Playgroud)
仅供参考:模板主要是空的,非空的模板包含基本表.我怎么能让它发挥作用?
我在ui-grid中使用AngularJS Bootstrap datepicker(3.0.0 - 不稳定)
我通过自定义cellTemplate(ui-grid)实现了datepicker:
{
field: 'Wiedervorl',
displayName: 'Wiedervorl.',
enableCellEdit: true,
enableCellEditOnFocus: true,
enableHiding: false,
cellTemplate: '<div><input ng-model="row.entity.Wiedervorl" ng-change="grid.appScope.addModifyFlag(row.entity)" ng-click="opened = true;" datepicker-popup="dd.MM.yyyy" is-open="opened" datepicker-options="grid.appScope.dateOptions" datepicker-append-to-body="true" type="text" /></div>',
cellFilter: 'date',
cellClass: function () {
return 'text-left';
},
filter: {
placeholder: 'date',
condition: uiGridConstants.filter.CONTAINS
},
width: '7%'
},
Run Code Online (Sandbox Code Playgroud)
在datepicker输入内部有一个标记'open',它与该输入元素的一个实例(datepicker实例)完全隔离.
问题是,在另一行中再打开一个日期选择器之后,前一个没有关闭,并且可以同时打开多个日期选择器.

我试图在输入中添加"ng-blur",但是当datepicker打开时,它会执行.
任何想法,如何完成UI-Grid内部之前的datepicker实例的关闭?一次只能激活一个.
谢谢
我试图用AngularJS引导提醒喜欢解释这里的"解雇上超时"属性.它在此示例中没有任何效果,警报只是定期出现并且不会消失.
<alert type="warning" dismiss-on-timeout="2000">Alert text</alert>
Run Code Online (Sandbox Code Playgroud)
但它确实可以在网站的ng-repeat示例中使用:
<alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)" dismiss-on-timeout="2000">{{alert.msg}}</alert>
Run Code Online (Sandbox Code Playgroud)
问题是缺少关闭属性吗?如果是这样,如何为不属于数组的警报编写close函数?
alert timeout twitter-bootstrap angularjs angular-ui-bootstrap
我正在使用UI Bootstrap(AngularJS)中的Ui-bootstrap popover .
页面边框的popover似乎离开了屏幕......
是否有更好的方法来定位弹出窗口 - 所以它可以留在屏幕内?
你可以看到popover被削减了......
angular.module('ui.bootstrap.demo', ['ngAnimate', 'ui.bootstrap']);
angular.module('ui.bootstrap.demo').controller('PopoverDemoCtrl', function ($scope) {
$scope.dynamicPopover = {
content: 'Hello, World!',
templateUrl: 'myPopoverTemplate.html',
title: 'Title'
};
});Run Code Online (Sandbox Code Playgroud)
<!doctype html>
<html ng-app="ui.bootstrap.demo">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-animate.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.14.3.js"></script>
<script src="example.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div ng-controller="PopoverDemoCtrl">
<h4>Dynamic</h4>
<div class="form-group">
<label>Popup Text:</label>
<input type="text" ng-model="dynamicPopover.content" class="form-control">
</div>
<div class="form-group">
<label>Popup Title:</label>
<input type="text" ng-model="dynamicPopover.title" class="form-control">
</div>
<div class="form-group">
<label>Popup Template:</label>
<input type="text" ng-model="dynamicPopover.templateUrl" class="form-control">
</div>
<button uib-popover="{{dynamicPopover.content}}" …Run Code Online (Sandbox Code Playgroud)twitter-bootstrap angular-ui-bootstrap twitter-bootstrap-tooltip
我正在使用Angular中的Bootstrap UI(https://angular-ui.github.io/bootstrap/)中的模态组件来渲染模态,并且在关闭时我希望能够重定向到另一个状态,或者至少有一个函数被调用.
问题是我可以拦截close事件,但每当我用户按下Esc模态时,我就会被解除,而且找不到任何捕获dismiss事件的文档或者为返回的promise指定一个函数.
代码如下:
var modalInstance = $uibModal.open({
templateUrl: 'a-template.html',
controller: 'AnotherCtrl',
controllerAs: 'modal',
backdrop: false,
size: 'lg'
});
// I am able to catch this whenever the user exits the modal in an
// orthodox fashion. Doesn't happen when he presses Esc button.
modalInstance.closed = function () {
$state.go(homeState);
};
Run Code Online (Sandbox Code Playgroud)
或者,另一种适合我的商业案例的解决方案是简单地不允许用户解雇模态.每当模态控制器中发生事件时自己关闭它.到目前为止我都没有找到这方面的功能.
在这个插件中,我有一个带有可拖动标题栏的Angular UI模式.拖动条形图时,整个模态会移动.问题是,如果我相对快速地上下移动鼠标,光标会失去对条的焦点,模态会停止移动.任何想法如何解决这一问题?任何其他方法也欢迎.
HTML
<body ng-app="app" ng-controller="ctl">
<script type="text/ng-template" id="myModalContent.html">
<div class="topbar">This is the title</div>
<div class="modal-header">
<h3 class="modal-title" id="modal-title">I'm a modal!</h3>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="button" ng-click="ok()">OK</button>
</div>
</script>
<button type="button" class="btn btn-default" ng-click="open()">Open me!</button>
</body>
Run Code Online (Sandbox Code Playgroud)
使用Javascript
var app = angular.module("app", ['ui.bootstrap']);
app.controller("ctl", function($scope,$uibModal,$timeout) {
var modalInstance;
$scope.open = function () {
modalInstance = $uibModal.open({
animation: false,
windowClass: 'the-modal',
templateUrl: 'myModalContent.html'
});
$timeout(function(){
$('.modal-content').draggable({
drag: function( event, ui ) {
if(event.toElement.className.indexOf("topbar") == -1 ) return false; …Run Code Online (Sandbox Code Playgroud) jquery-ui jquery-ui-draggable angularjs angular-ui angular-ui-bootstrap
angularjs ×7
angular-ui ×2
javascript ×2
alert ×1
jquery-ui ×1
modal-dialog ×1
modalpopups ×1
timeout ×1