我正在使用AngularJS + UI Bootstrap提供的"模态"指令.模态对话框效果很好,但我有一个问题:URL没有变化.
例如,我的AngularJS应用程序具有为"/ people"设置的路线,该路线显示人员列表.当用户点击某个人时,会出现一个模态对话框并显示详细信息.我试图弄清楚如何修改URL而不实际导致$ routeProvider重新执行控制器.
例如,我可以在我的路线中有类似的东西:
$routeProvider.
when('/people', {controller: PeopleCtrl, templateUrl: 'templates/people.html'}).
when('/people/:personId', {controller: PeopleCtrl, templateUrl: 'templates/people.html'}).
Run Code Online (Sandbox Code Playgroud)
然后在我的PeopleCtrl中我可以这样做:
if ($routeParams.personId) {
$scope.editPerson({id: $routeParams.personId});
}
Run Code Online (Sandbox Code Playgroud)
这基本上调用了我绑定的同一个函数,点击人行.这适用于允许我的应用程序响应像/ people/123这样的URL,但我无法弄清楚如何让URL从/ people跳转到/ people/123然后回到/ people作为模态对话框打开和关闭.
显然,我可以调用$ location.path("/ people"),但问题是PeopleCtrl得到重新启动,我想避免这种情况,因为应该保留模态"后面"的状态.
换句话说:我正在寻找一种方法来更改URL /位置,而不会检测到正常的$ routeProvider更改.
谢谢!
modal-dialog twitter-bootstrap angularjs angular-ui-bootstrap
我正在开发一个带有UI Bootstrap的Angular Web应用程序,并且使用UI选项卡遇到了flot图表中y-tick标签对齐的问题.
使用标准引导选项卡,图表在tabset内部和外部匹配:http: //jsfiddle.net/TDwGF/614/
但是,使用UI Bootstrap tabset,我们发现y-tick标签与图重叠:http:
//jsfiddle.net/TDwGF/615/
在使用不同的方法来构建flot指令时,我可以创建一个图表,其中只有一半的y-tick标签未对齐(但是在最小的例子中我无法再现这个).

我找不到任何会导致这些问题的继承css修改,而且我没有遇到任何运气通过tabs指令源代码.
任何帮助,将不胜感激.
我使用angular-dynamic-locale来改变UI Bootstrap的datepicker 的语言(我不想在服务器端添加正确的本地化源文件.因此,我需要更动态的东西).
加载本地化文件.然而,当我打开一个datepicker我的网页上,定位发生后,才通过切换到新的月份<,>按钮.
有没有办法让这种变化直接发生?
locale localization datepicker angularjs angular-ui-bootstrap
我正在使用AngularJS和Angular UI Bootstrap.
在我的模板中,我需要显示一个表,我用ng-repeat创建它,我需要在点击时为某些单元添加一个弹出框.
我做了类似这样的例子: 在plunker中的ng-repeat里面的popover例子
如何仅在某些单元格中有条件地使用弹出窗口?
使用最新的angular-ui-bootstrap和日期选择器指令来进行日期选择,但我想知道的是,是否可以让日期选择器为文本框选择两种不同的格式.
<input type="text"
class="form-control"
ng-model="vm.startDate"
uib-datepicker-popup="M/d/yyyy"
datepicker-options="vm.dateOptions"
close-text="Close"
is-open="vm.opened1"
placeholder="Start Date"
ng-required="false"
min-date="vm.minDate"
max-date="vm.maxDate"
init-date="vm.getCalendarInitDate()"
/>
Run Code Online (Sandbox Code Playgroud)
uib-datepicker-popup ="M/d/yyyy"适用于2015年9月5日这样的日期但是那些投放于9/5/15的人呢?它没有用.
理想情况下,我希望它们都可以接受.
有任何想法吗?
我希望在关闭时保持我的bootstrap.ui(或ngdialog !!)模态窗口的状态.知道如何展示/隐藏模态窗口吗?
谢谢.
我2011-11-14T14:48:00从Web API 收到ISO 8601格式的日期,因为这是默认情况下日期序列化的方式。在客户端上,我将日期值与输入控件绑定,并且将UI Bootstrap datepicker用于日期控件。绑定发生得很好,我可以以任何指定的日期格式查看日期。但是,当我从控件中跳出而不进行任何更改时,模型值将变为无效。我认为日期无效,因为如果我删除日期值中的一个数字并重新输入该数字,然后跳出,则模型值将变为有效。
标记
<input type="text" uib-datepicker-popup="{{dateFormat}}" ng-model="statusChangeDate" datepicker-options="dateOptions" is-open="opened" />
<span class="input-group-btn">
<button type="button" ng-click="open($event, 'status')"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
Run Code Online (Sandbox Code Playgroud)
控制者
// This will come from a Web API call
$scope.statusChangeDate = '2011-11-14T14:48:00';
Run Code Online (Sandbox Code Playgroud) 我想在打开ui bootstrap模式时暂时更改浏览器URL(后面的页面应保持原样,只有url更改).当模态关闭时,URL应该恢复为原始模式.
脚步 :
示例实现:Pinterest引脚及其引脚详细信息弹出.
angularjs angular-ui-bootstrap angular-ui-router angular-ui-modal
给定一个带有输出绑定的组件,如下所示:
angular.module('app').component('myComponent', {
templateUrl: 'myComponent.html',
bindings: {
onSelect: '&'
},
controller: class {
selectedItems = [];
// called when the user clicks a button, outputs an array of selected items
selectItems() {
this.onSelect({items: this.selectedItems});
}
}
});
Run Code Online (Sandbox Code Playgroud)
如果用作标记,我可以使用以下代码获取所选项:
<my-component on-select='$ctrl.select(items)' />
Run Code Online (Sandbox Code Playgroud)
如何使用ui.bootstrap实现相同的功能uibModal.open?
这似乎不起作用:
$uibModal.open({
component: 'myComponent',
resolve: {
onSelect: () => (items) => { console.log('parent event handler', items); }
}
});
Run Code Online (Sandbox Code Playgroud) 我有一个ngbTypeahead,它在字段中键入时应该能够查询对象列表。列表“投影”中对象的形式为
{
code: "6326"
group: "world"
name: "WGS 1984"
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<input id="typeahead-basic" type="text" class="form-control" [(ngModel)]="item.outputProjection.name" [ngbTypeahead]="search" />
Run Code Online (Sandbox Code Playgroud)
在component.ts类中搜索过滤器代码:
search = (text$: Observable < string > ) =>
text$.pipe(
debounceTime(200),
distinctUntilChanged(),
merge(this.focus$),
map(term => (term === '' ? this.projections :
this.projections.filter(v => v.name.toLowerCase().indexOf(term.toLowerCase()) > -1)).slice(0, 10))
)
Run Code Online (Sandbox Code Playgroud)
当我输入时,我得到的是:
但是我想显示的是json对象中的名称。
另外,bootstrap的人也关闭了它并说这不是错误,而是功能请求:
https://github.com/valor-software/ngx-bootstrap/issues/749
无论平台如何,大多数现代UI控件都可以使用对象。
angularjs ×8
datepicker ×2
javascript ×2
angular ×1
angular-ui ×1
flot ×1
html ×1
locale ×1
localization ×1
modal-dialog ×1
ng-repeat ×1
popover ×1
typeahead ×1
typescript ×1