标签: angular-ui-bootstrap

使用AngularJS和模态对话框清理URL

我正在使用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

5
推荐指数
1
解决办法
2509
查看次数

带有Flot的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标签未对齐(但是在最小的例子中我无法再现这个).

未对齐的y轴刻度

我找不到任何会导致这些问题的继承css修改,而且我没有遇到任何运气通过tabs指令源代码.

任何帮助,将不胜感激.

javascript flot angularjs angular-ui angular-ui-bootstrap

5
推荐指数
1
解决办法
366
查看次数

角动态区域设置无法立即生效

我使用angular-dynamic-locale来改变UI Bootstrap的datepicker 的语言(我不想在服务器端添加正确的本地化源文件.因此,我需要更动态的东西).

加载本地化文件.然而,当我打开一个datepicker我的网页上,定位发生后,才通过切换到新的月份<,>按钮.

有没有办法让这种变化直接发生?

locale localization datepicker angularjs angular-ui-bootstrap

5
推荐指数
1
解决办法
893
查看次数

在ng-repeat中有条件地添加一个Angular Bootstrap popover

我正在使用AngularJS和Angular UI Bootstrap.

在我的模板中,我需要显示一个表,我用ng-repeat创建它,我需要在点击时为某些单元添加一个弹出框.

我做了类似这样的例子: 在plunker中的ng-repeat里面的popover例子

如何仅在某些单元格中有条件地使用弹出窗口?

popover angularjs ng-repeat angular-ui-bootstrap

5
推荐指数
1
解决办法
3289
查看次数

有什么办法让angular-ui-bootstrap日期选择器接受多种日期格式?

使用最新的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的人呢?它没有用.

理想情况下,我希望它们都可以接受.

有任何想法吗?

angular-ui-bootstrap

5
推荐指数
1
解决办法
1261
查看次数

AngularJS - 可以ng-show/ng-hide模态窗口?

我希望在关闭时保持我的bootstrap.ui(或ngdialog !!)模态窗口的状态.知道如何展示/隐藏模态窗口吗?

谢谢.

html javascript angularjs angular-ui-bootstrap

5
推荐指数
1
解决办法
1万
查看次数

UI Bootstrap datepicker表示ISO-8601日期字符串的日期无效

我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)

datepicker asp.net-web-api angularjs angular-ui-bootstrap

5
推荐指数
1
解决办法
2970
查看次数

Angularjs UI引导程序在打开时临时更改URL,并在关闭时恢复为原始URL

我想在打开ui bootstrap模式时暂时更改浏览器URL(后面的页面应保持原样,只有url更改).当模态关闭时,URL应该恢复为原始模式.

脚步 :

  1. 用户加载页面
    • 网址:xyz.com/home
  2. 用户点击链接打开模态
    • url:xyz.com/detail/123
    • 可能的解决方案:使用html5推送状态更改URL
    • 问题:Angular ui-router尝试按照更改的URL运行其路由,最终更改后台页面.
  3. 用户关闭模态
    • 网址:xyz.com/home
    • 可能的解决方案:html5 pop状态
    • 问题:重新加载背景页面,这会杀死目的

示例实现:Pinterest引脚及其引脚详细信息弹出.

angularjs angular-ui-bootstrap angular-ui-router angular-ui-modal

5
推荐指数
1
解决办法
855
查看次数

如何从ui bootstrap的uibModal.open设置组件输出绑定

给定一个带有输出绑定的组件,如下所示:

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)

angularjs typescript angular-ui-bootstrap

5
推荐指数
1
解决办法
396
查看次数

JSON对象列表的Angular 6 ngbTypeahead过滤器

我有一个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控件都可以使用对象。

typeahead angular-ui-bootstrap angular

5
推荐指数
1
解决办法
4891
查看次数