使用typeahead,我试图设置几个选项,它们可用作标准的Bootstrap typeahead选项
使用下面的代码,我可以通过将其设置为"typeahead-min-length"来设置"minLength"属性,但是对"item"作为"typeahead-items"执行相同操作则不行.有没有不同/更好/标准的方法来做到这一点?有没有办法将一系列选项附加到$ scope?
<div class='container-fluid' ng-controller="TestController">
<input type="text" ng-model="selected"
typeahead="foo for foo in foo | filter:$viewValue" typeahead-items='5' typeahead-min-length='3'>
<pre>{{selected| json}}</pre> </div>
Run Code Online (Sandbox Code Playgroud)
更新:我试图坚持使用AngularJS,而不是使用jQuery
这是我的控制器:
myAppModule.controller('TestController', function($http,$scope) {
$scope.selected = undefined;
$http.get('data/sample.json')
.then(function(results){
$scope.foo = results.data;
});
});
Run Code Online (Sandbox Code Playgroud) 我使用带有Grails 2.3.x资产管道的angular-ui-bootstrap:1.6.1插件.其中一个组件 - alert.js正在尝试加载/template/alert/alert.html,但这会解析为404.
我试过包括grails.assets.includes = [*/ .html],没有帮助.
有什么解决方法吗?无论如何让资产管道包含部分模板?
根据http://getbootstrap.com/javascript/#dropdowns事件(例如,show.bs.dropdown,hide.bs.dropdown)在打开/关闭drowdown时抛出.这有效直到模块bootstrap-ui处于活动状态.我创建了一个显示问题http://plnkr.co/edit/luYpweQZx22IkWHeMKhM的plunkr .当删除对ui.boostrap的依赖时,抛出事件,即
var app = angular.module('myapp', ['ui.bootstrap']);
Run Code Online (Sandbox Code Playgroud)
被替换为
var app = angular.module('myapp', []);
Run Code Online (Sandbox Code Playgroud)
版本是:Bootstrap 3.0.3,Angular 1.2.4(也用1.2.13测试),Angular UI Bootstrap 0.10.0,JQuery 2.0.3
似乎是bootstrap-ui中的一个错误,任何解决方法的想法?
我目前遇到的问题是datepicker自动将我的时间转换为UTC.有没有什么我可以传递到datepicker为它不给我一个UTC转换字符串?例如,用户在日历上选择3月19日,返回的字符串将是这样的
'2014-03-19T04:00:00.000Z'
Run Code Online (Sandbox Code Playgroud)
我想要的是 - >
'2014-03-19T00:00:00-04:00'
Run Code Online (Sandbox Code Playgroud)
我现在正在尝试(有点乱砍)试图使用时刻js将其转换回我想要的(预期的)格式,但是我没有在那里硬编码减法的情况下这样做.我希望能够将它从UTC转换回本地时间.
有没有人知道使用瞬间js或角度的解决方案?
datepicker angularjs momentjs angular-ui angular-ui-bootstrap
我正在采取Angular的第一步,并希望我在正确的位置找到我的问题/问题的答案.如果没有,请指出我正确的方向.
我正在使用角度UI引导弹出日期选择器,如下例所示:http: //angular-ui.github.io/bootstrap/#/datepicker
当我将其与uiMask指令(http://angular-ui.github.io/ui-utils/)结合使用时,当我选择日期时,输入中的值会被加扰.
我怀疑是因为角度模型的类型不同:datepicker想要JS Date对象/ ui.mask想要(蒙面)字符串.
当选择的日期被uiMask格式化/解析时,它会出错: - /
我想做什么甚至可能?
亲切的问候,汤姆.
我有三个静态选项卡和一个按钮,使用ng-click ="selectThirdTab()"
<div ng-controller="Ctrl">
<input type="button" value="Select third tab" ng-click="selectThirdTab()" />
<tabset justified="true">
<tab heading="First" active="isFirstActive"></tab>
<tab heading="Second" active="isSecondActive"></tab>
<tab heading="Third" active="isThirdActive"></tab>
</tabset>
</div>
Run Code Online (Sandbox Code Playgroud)
函数"selectThirdTab"如下:
$scope.selectThirdTab = function () {
$scope.isThirdActive = true;
}
Run Code Online (Sandbox Code Playgroud)
吸管在这里:Plunker
最初选择第一个选项卡,单击按钮,结果是选中的第三个按钮.现在,如果您选择其他选项卡,然后再次单击"选择第三个选项卡"按钮,则不会选择第三个按钮.怎么了?
我使用angular-ui下拉
它工作正常,但我不知道如何处理下拉菜单中的多个项目.
请考虑以下Plunker中的示例
HTML
<div class="btn-group" dropdown is-open="status.isopen">
<button type="button" class="btn btn-primary dropdown-toggle" ng-disabled="disabled">
Button dropdown <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="item in items"><a href="#">{{item}}</a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
我想要定义滚动并缩短下拉列表.
有任何想法吗?
我正在尝试将日期选择器设置为月份选择器.只要你点击一个月和/或去上一年/明年,一切都按预期工作.但是,如果要通过单击顶部的当前年份来扩大年份选择,则会出现JavaScript错误.
HTML:
<div ng-app="app">
<div ng-controller="TestController">
<input type="date" class="form-control" ng-model="date" datepicker-popup="MM/yyyy" is_open="date_opened" ng-focus="date_opened = true" ng-click="date_opened = true" datepicker-options="datepickerOptions">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
(function() {
'use strict';
var app = angular.module('app', [
'ui.bootstrap'
]);
app.controller('TestController', ['$scope', function($scope) {
$scope.datepickerOptions = {
datepickerMode: "'month'",
minMode: 'month'
};
}]);
})();
Run Code Online (Sandbox Code Playgroud)
这是JSFiddle演示它(angularjs 1.2.26,ui-bootstrap 0.11.2).
我有这个popover模板
<i class="fa fa-link" popover-placement="right" uib-popover-template="'newReferenceTemplate.html'" popover-title="New link"> Add new external reference </i>
Run Code Online (Sandbox Code Playgroud)
因此,当我点击该链接图标时,将打开一个带有此模板的弹出窗口
<script type="text/ng-template" id="newReferenceTemplate.html">
<label>Title</label> <br>
<input ng-model="link.Title"> <br>
<label>Url</label> <br>
<input ng-model="link.Url"><br>
<i class="fa fa-floppy-o" > Save </i>
</script>
Run Code Online (Sandbox Code Playgroud)
当我按下"软盘"图标时,我想关闭弹出窗口.有没有办法做到这一点?
我在文档上找到的只是popover-is-open价值,但我不知道我是否可以以某种方式使用它,任何想法?
由于我是角色与打字稿的新手,我在实现角度模态弹出时面临一个问题.问题是我有一个下拉列表,我必须打开一个模态弹出窗口,而模态弹出窗口将有两个按钮"是"或"否".为此,我有一个控制器,我注入了一个依赖.
export class QuestionnaireController {
static ngControllerName = 'questionnaireController';
static inject = ["$uibModal"];
constructor(private $uibModal: ng.ui.bootstrap.IModalService) {
}
public openModalPopup() {
let options: ng.ui.bootstrap.IModalSettings = {
controller: QuestionnaireController,
controllerAs:'ctrl',
templateUrl: 'app/views/Dialogbox.html',
};
this.$uibModal.open(options);
}
}
Run Code Online (Sandbox Code Playgroud)
我的大多数代码都是用'QuestionnaireController'编写的,弹出窗口正在使用这个控制器打开,但我也想关闭这个弹出窗口,所以我读了一篇文章写的,我必须创建一个新的控制器"ModalController"来弹出关.
export class ModalController {
static inject = ["$uibModalInstance"];
constructor(private $uibModalInstance: ng.ui.bootstrap.IModalServiceInstance) {
}
public close() {
this.$uibModalInstance.close();
}
}
Popup code is here...
<div ng-app="" id="dvModal">
<div class="modal-header">
</div>
<div class="modal-body">
<p> Evaluated result will be discarded if you continue. Are you sure you …Run Code Online (Sandbox Code Playgroud) modal-dialog popup angularjs typescript angular-ui-bootstrap
angularjs ×10
angular-ui ×3
datepicker ×2
css ×1
grails ×1
html ×1
javascript ×1
modal-dialog ×1
momentjs ×1
popup ×1
tabs ×1
typeahead ×1
typescript ×1