标签: angular-ui-bootstrap

在角度引导程序中设置初始静态选项卡

我似乎无法在角度引导标签集中设置初始选项卡.它始终将最左侧的选项卡设置为活动状态.

鉴于html:

<tabset>
    <tab heading="Static 1" active="data.static1">Static content</tab>
    <tab heading="Static 2" active="data.static2">Static content</tab>
</tabset>
Run Code Online (Sandbox Code Playgroud)

和js:

angular.module('plunker', ['ui.bootstrap']);
var TabsDemoCtrl = function ($scope) {
  $scope.data = {static1: false, static2: true}
};
Run Code Online (Sandbox Code Playgroud)

见Plunker

2013年8月6日更新:现在修复上游,请参阅github问题.

angularjs angular-ui-bootstrap

8
推荐指数
1
解决办法
9943
查看次数

如何显示隐藏在导航栏后面的popover

我是Bootstrap和Angular的新手.在我的网页上有一个按钮,我提供了这样的跨度的弹出窗口

<span popover="Download Project History" popover-trigger="mouseenter" tooltip-placement="top" style="padding: 5px" translate="DOWNLOAD">DOWNLOAD</span>
Run Code Online (Sandbox Code Playgroud)

但它被隐藏在导航栏下.

根据我的谷歌搜索,我发现在html元素中提供data-container ="body".但它不起作用.

谁能帮帮我吗?

谢谢

angularjs angular-ui-bootstrap

8
推荐指数
1
解决办法
6179
查看次数

ui.bootstrap模态加载html但没有显示任何内容

它的装载开口模态和指定的加载模板.但没有显示任何东西.

在这里查看演示:http://demo.hupp.in/food-admin

转到[Products]和Search EnegiKcal> = 3500.然后单击manage.它将打开弹出窗口但未加载模板内容.

另外我注意到的另一件事是它有时会返回模板的HTTP 304.

这是我打开模态的方式:

/** Open Modal For add edit tags */
$scope.open = function (productId) {

    var modalInstance = $modal.open({
        templateUrl: 'views/some.html',
        controller: tagsModalInstanceCtrl,
        size: 'lg'
    });

    modalInstance.result.then(function (msg) {

    }, function () {
        // $log.info('Modal dismissed at: ' + new Date());
    });

};  

var tagsModalInstanceCtrl = function ($scope, $modalInstance) {

    $scope.ok = function () {
        $modalInstance.close("hi");
    };

    $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
    };
};
Run Code Online (Sandbox Code Playgroud)

这是模板代码:

<div class="modal-header"> …
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-bootstrap

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

如何在单独的文件中分离ng-template

我正在使用angularUI typehead作为输入元素.我正在使用自定义模板来显示值.一切正常.我的问题是如何将其ng-template分成单独的文件,以便它也可以在其他文件中重复使用.

如果我的话不清楚,请注意我是指ng-templates具体而不关心其他单独的HTML内容

这是代码:

 // custom template begin 
 // this is the ng-template
 // I'd like to move this custom template into to another file 
 // similar to partials
 <script type="text/ng-template" id="customTemplate.html">
    <a>
        <b>{{match.model.name}}</b>
        <div>{{match.model.username}}</div>
    </a>
</script>
 //custom template end


// input element makes use of the ng-template defined above
<div class="form-group">
<label class="col-md-2 control-label normal" for="assignTo">Assign To</label>
 <div class="col-md-3">
    <input name="bug_assignTo" id="bug_assignTo" ng-model="bug.assignTo" typeahead="user.username as user.name for user in config.users | filter:$viewValue | …
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-bootstrap angularjs-ng-template

8
推荐指数
1
解决办法
8310
查看次数

如何在Tooltip中显示HTML格式的内容?(UI日历)

我正在尝试在UI日历的日历条目的工具提示中显示多行内容,但它无法正常工作.

这是代码

$scope.onEventRender = function(event, element, view) {
    if(event.hover_data) {
        $timeout(function(){
            var hdata = event.hover_data.join('<br />');
            element.attr({'tooltip': hdata, 'tooltip-append-to-body': true});
            $compile(element)($scope);
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

这是它的外观

在此输入图像描述

请让我知道我做错了什么.

fullcalendar angular-ui-bootstrap

8
推荐指数
1
解决办法
3583
查看次数

加载Angular UI Bootstrap Datepicker时将日期字符串解析为Date对象

我正在使用Angular UI Bootstrap Datepicker:https://angular-ui.github.io/bootstrap/#/datepicker

当我使用从服务器接收的数据呈现表单时,datetime字段存在问题.我的输入日期选择器如下所示:

<form name="itemForm">
    <input type="datetime" class="form-control" id="startedAt" name="startedAt"
           ng-model="item.startedAt"
           ng-click="open($event, 'startedAt')"
           uib-datepicker-popup="yyyy-MM-dd"
           is-open="datepickers.startedAt"
    />
</form>
Run Code Online (Sandbox Code Playgroud)

我的服务器将响应日期时间作为JSON字符串返回:

{    
   ...
   startedAt: "2015-05-29T02:00:00+0200"
}
Run Code Online (Sandbox Code Playgroud)

当我将响应数据分配给模型时$scope.item = response;,会正确呈现datepicker输入字段(选择正确的日期并按照我选择的格式正确格式化).问题是验证没有通过.我明白了:

itemForm.startedAt.$invalid == true
Run Code Online (Sandbox Code Playgroud)

我注意到绑定到datepicker字段的数据应该是Date对象而不是字符串(当我从datepicker中选择新日期时,$scope.item.startedAt是一个Date)

我设法解决了这个问题并在控制器中执行此操作:

$scope.item = response;
$scope.item.startedAt = new Date($scope.item.startedAt);
Run Code Online (Sandbox Code Playgroud)

它以这种方式工作......但我不希望每次从服务器获得响应时手动转换字符串do日期.我试图创建一个指令,我可以将其分配给datepicker输入字段,以便它ng-model为我转换:

.directive("asDate", function () {
    return {
        require: 'ngModel',
        link: function (scope, element, attrs, modelCtrl) {

            modelCtrl.$formatters.push(function (input) {

                var transformedInput = new Date(input);

                if (transformedInput != input) …
Run Code Online (Sandbox Code Playgroud)

json datepicker angularjs angular-ui angular-ui-bootstrap

8
推荐指数
1
解决办法
9905
查看次数

禁用Angularjs日期选择器中的特定日期

我想在日期选择器中禁用特定日期AngularJS.

我正在使用AngularJS-bootstrapcss作为组件.

我要禁用的日期将根据组合中先前值的选择动态更改.

我相信date-disabled="disabled(date, mode)"应该工作,但不确定.

我怎样才能做到这一点 ?

javascript angularjs angular-ui-bootstrap

7
推荐指数
2
解决办法
4万
查看次数

编译错误,需要手风琴控制器

使用angular-bootstrap ui时,我在控制台中遇到了以下错误.我有角度1.2.6,bootstrap 3.0和angular-bootstrap 0.10.0.

错误:[$ compile:ctreq]无法找到指令'accordionGroup'所需的控制器'accordion'!

谁知道为什么会这样?我的HTML代码.

<div ui-view>
        <accordion-group id="crud-talbe" ng-repeat="grid in grids" heading="{{grid.name}}">
            <a ng-click="createNewEntity(grid.name)" class="btn btn-default">create new {{grid.name}}</a>
            <div class="crudGridStyle" ng-grid="grid" />
        </accordion-group>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angular-ui-bootstrap

7
推荐指数
1
解决办法
8453
查看次数

Angular JS UI Bootstrap选项卡(ui.bootstrap.tabs)使页面在select上滚动/跳转

选择选项卡会导致页面随机滚动,例如选择选项卡可以将页面几乎一直滚动到顶部,然后我必须向下滚动才能看到选项卡的内容,如果我选择另一个选项卡页面再次滚动.

标签的内容大小可变,有些元素比其他元素多,所以它们自然具有不同的高度,但我不确定这是否是随机页面滚动的原因.

我尝试了一些jquery来禁用链接默认操作而没有运气.

$(function () {
   $('body').on('click', 'a[ng-click="select()"]', function (event) {
      event.preventDefault();
   });
});
Run Code Online (Sandbox Code Playgroud)

另一个丑陋的解决方案是我将tabset包装在div中并在div上设置一个高度

<div class="col-md-12" id="profile-nav-tabs" style="
         height:500px;
         overflow-y: auto;
         overflow-x:hidden
         ">
        <tabset justified="true">
            <tab  heading="{{::strings.profile}}">
                <br />
                <div  ng-include="'tab-profile.php'"></div>
            </tab>
            .... more tabs
       </tabset>
</div>
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-bootstrap twitter-bootstrap-3

7
推荐指数
1
解决办法
959
查看次数

AngularJS和UI-Bootstrap选项卡,使用ng-class修改选项卡

我正在使用ui-tabs在一个项目上使用AngularJS和UI-Bootstrap.

粗略的布局是这样的:

<uib-tabset>
    <uib-tab ng-repeat="tab in tabs" heading="{{tab.TAB_NAME}} : {{tab.Questions|sumByKey:'count'}} of {{tab.Questions.length}}" active="tab.active" disable="tab.disabled">

    <!-- Repeated Content -->

    </uib-tab>
</uib-tabset>
Run Code Online (Sandbox Code Playgroud)

sumByKey:'count'是一个过滤器,用于计算重复选项卡对象中'count'字段的总和.这将跟踪已回答的问题,tab.Questions.length计算选项卡中重复的问题数.

我可以在选项卡名称中显示这两个,因为我在这里工作,这是有效的,因此在每个选项卡中,选项卡名称是名称:问题 - 回答总问题,即:'停车:1的5'.

我想要做的是当这些数字相等时,使用ng-class将"已完成"类添加到选项卡,并且该选项卡中的所有问题都已得到解答.

我可以在选项卡中添加一个class ='complete',这样可行,但尝试使用ng-class根本不起作用,甚至ng-class ="complete".

有没有办法做到这一点?ng-class可以和uib-tabs一起使用吗?是否有其他机制来评估表达式并修改选项卡上的类?

angularjs angular-ui-bootstrap

7
推荐指数
1
解决办法
7313
查看次数