标签: angular-ui-bootstrap

Rails中的Angular ui bootstrap自定义模板

如何在rails中使用angular ui bootstrap的自定义模板?

我的意思是,如果我使用pagination它,它会寻找一个templates/pagination/pagination.html模板.

问题是rails不会在该路径中提供模板,它实际上需要assets/templates/pagination/pagination.html使用<%= asset_path(....) %>帮助程序.

攻击角度ui bootstrap javascript文件是一种方式,但我不想每次获得新版本时都会破解它.

ruby-on-rails angularjs angular-ui-bootstrap

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

在angular-ui引导程序警报中包含链接?

如何在angular-ui bootstrap警报中包含链接?

尝试:

警报

Plunker示例

HTML

<div ng-controller="AlertDemoCtrl">
    <alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</alert>
    <button class='btn' ng-click="addAlert()">Add Alert</button>
</div>
Run Code Online (Sandbox Code Playgroud)

脚本

function AlertDemoCtrl($scope) {
  $scope.alerts = [
    { type: 'error', msg: 'Oh snap! Change a few things up and try submitting again.' }, 
    { type: 'success', msg: '<a href="">Well done!</a> You successfully read this important alert message.' }
  ];

  $scope.addAlert = function() {
    $scope.alerts.push({msg: "Another alert!"});
  };

  $scope.closeAlert = function(index) {
    $scope.alerts.splice(index, 1);
  };

}
Run Code Online (Sandbox Code Playgroud)

escaping angularjs angular-ui angularjs-directive angular-ui-bootstrap

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

Angular UI Timepicker垂直对齐

我正在使用Angular UI中的timepicker控件 - Bootstrap,我无法弄清楚如何垂直居中.它基本上是其他控件的3倍,默认情况下是标签/ etc.似乎与时间输入框上方的^对齐.

我想弄清楚如何垂直居中,或垂直收缩它,因此它与常规输入盒的大小相同.

我知道表单控件类会垂直对齐它,但添加它会产生时髦的东西.输入框呈现正确的尺寸,但时间戳仍然在输入顶部始终(垂直偏离中心)渲染.

或者,有人可以推荐一种直接的方式来使用Angular.js和Bootstrap来请求输入日期和时间吗?

我的标记如下:

<div class="panel-body container-fluid">
    <div class="well well-lg container-fluid form-horizontal">
        <div class="form-group">
            <label for="idStartDate" class="col-md-2 control-label">Received After</label>
            <p class="col-md-2 input-group">
                <input type="text" class="form-control" datepicker-popup="MM/dd/yyyy" ng-model="startDate"
                       is-open="startDateOpened" max-date="endDate || today" datepicker-options="dateOptions"
                       placeholder="Received after" id="idStartDate"/>
                <span class="input-group-btn">
                  <button type="button" class="btn btn-default" ng-click="openStartDate($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                </span>
            </p>
        </div>
        <div class="form-group">
            <label for="idStartTime" class="col-md-2 control-label">Time</label>
            <div class="col-md-2">
                <timepicker id="idStartTime" ng-model="startTime" minute-step="15"></timepicker>
            </div>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

的jsfiddle

twitter-bootstrap angular-ui-bootstrap

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

在angular-ui-bootstrap轮播上设置活动幻灯片

我正在使用角度,引导程序和一个名为"ui-bootstrap"的插件来制作旋转木马.

我有一个缩略图列表,当点击一个模式时,会在旋转木马内显示高清晰度的图像,类似于您在亚马逊或其他网站上的图像.我试图将旋转木马中第一个显示的图像设置为用户点击的图像.

我已经能够使用$ index获取图像的索引,因为我在ng-repeat中,将它提供给模态控制器并显示轮播没有问题.但第一个图像我总是索引0,即使我尝试设置我拥有的索引.

这些是我尝试的一些事情:

    $scope.SliderItems = items; // This one sets the items in the slider array

    items[selectedIndex].active = true;
    $scope.SliderItems[selectedIndex].active = true;
    $scope.SliderItems.select(SliderItems[selectedIndex]);
Run Code Online (Sandbox Code Playgroud)

我还试图在一个属性上设置它,在显示它所需的项目上将"active"属性设置为true但是然后它被阻止在该项目上,导致旋转木马崩溃.此外,尝试了旋转木马元素上的"data-slide-to"属性但没有成功.

    $scope.SelectedIndex = selectedIndex;
Run Code Online (Sandbox Code Playgroud)

所以我不知道使用哪个属性/方法来执行此操作,插件页面上的文档也没有给我更多的指示:(

http://angular-ui.github.io/bootstrap/

有谁知道如何设置默认的活动幻灯片?甚至如何在加载它之后设置它,因为在底部有一个带缩略图的旋转木马,你可以点击它来显示主图像或其他东西.

谢谢.

解决了

我之前尝试做过这样的事情并且没有以某种方式工作,但是这次我尝试使用不同的方法再次尝试.因此,在Controller上设置.active = true后,这是HTML:

    <carousel>
        <slide ng-repeat="item in SliderItems" active="item.active">
            ...
        </slide>
    </carousel>
Run Code Online (Sandbox Code Playgroud)

以防万一,控制器:

    $scope.SliderItems = items; // items comes from another controller with the items
    $scope.SliderItems[selectedIndex].active = true; //selectedIndex also comes from the other controller
Run Code Online (Sandbox Code Playgroud)

javascript carousel angularjs angular-ui-bootstrap

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

更改AngularJS UI Bootstrap datepicker的日历高度和宽度

我正在使用Angularjs UI Bootstrap datepicker(http://plnkr.co/edit/kMXeOm5ct4pPFH0ZJc8u?p=preview),它工作正常.但我需要改变压光机的高度和宽度.可能吗?.以下是我的代码:

  <div class="col-md-6">
    <p class="input-group">
        <input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" min-date="minDate" 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" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
              </span>
    </p>
</div>
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui angular-ui-bootstrap

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

将参数传递给模态对话框

我正在尝试使用简单的模态对话框来编辑Angular应用程序上下文中的列表中的项目.对于模态,我使用UI-Bootstrap(AngularUI),我知道它仍然存在Bootstrap 3的问题,但AFAIK可以用于一些简单的变通方法(除非构建AngularUI的尚未发布的分支).我在这里创建了一个简单的repro Plunker:

http://plnkr.co/edit/MWa3bLMqIkwxmxQ6YDSl

示例代码有几个控制器,一个与open它应该开模态方法,和另一种与save和close方法按钮保存和取消.此外,CSS包含一些解决方案,用于处理Bootstrap 3的AngularUI问题.显示模式对话框,但它不接收从调用控制器传递的参数.要传递此参数(item具有id和名称的虚拟对象),我使用resolve模态打开方法调用中的选项,如:

resolve: {
  item: function() {
    return angular.copy(item);
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,item应在对话框控制器中解析的参数似乎未定义.我在这里缺少什么?谢谢!

javascript twitter-bootstrap angularjs angular-ui-bootstrap

6
推荐指数
1
解决办法
8690
查看次数

Angularjs datepicker popup bootstrap-ui在视图中不起作用

我是一个angularjs和bootstrap ui新手!我的日期选择器弹出窗口在我的包含视图中不起作用.如果它在视图之外,它可以工作.即在此处演示任何协助将不胜感激.但是,因为我使用ngRoute方法,我需要在部分html中编写我的视图并包含在主index.html中.内联日历不显示,弹出日历也不显示.我无法弄清楚问题,但我认为date-picker.html无法在我的index.html中引用脚本和样式.我在日期选择器hmtl中有其他包含窗格,它引用了index.html中的脚本和css.任何帮助将不胜感激.以下是代码:

**index.html**

    <!doctype html>
    <html lang="en" ng-app="ngdemo">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Some Services</title>
        <link rel="stylesheet" href="css/app.css"/>
        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>   
        <script src="js/app.js"></script>
        <script src="js/services.js"></script>
        <script src="js/controllers.js"></script>
        <script src="js/filters.js"></script>
        <script src="js/directives.js"></script>
        <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">

    </head>

    <body>

<ul class="menu">
    <li><a href="#/date-picker"> <b> Date Management </b> </a></li> 
</ul> 

    <div ng-view></div>

    </body>
    </html>
Run Code Online (Sandbox Code Playgroud)

*app.js *

'use strict';

// Declare app level module which depends on filters, and services
angular.module('ngdemo', ['ngRoute','ngdemo.filters','ngdemo.services', 'ngdemo.directives', 'ngdemo.controllers']).
    config(['$routeProvider', function ($routeProvider) {
        $routeProvider.when('/date-picker', …
Run Code Online (Sandbox Code Playgroud)

javascript datepicker twitter-bootstrap angularjs angular-ui-bootstrap

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

在Internet Explorer中使用自动对焦时,模式中的奇怪光标位置

在IE中使用自动对焦时,我遇到光标放置问题.图像应清楚地显示问题.

fubar光标放置

幸运的是,我已经能够在一个plunker中重现这一点.我已经把它剥离到了必需品,所以应该很容易看到发生了什么.

我如何使IE表现?

AngularJS(也可用于plunker)

app.directive('autofocus', [
  '$timeout', function($timeout) {
      return function(scope, elem, attr) {
          scope.$on('autofocus', function(e) {
              $timeout(function() {
                  elem[0].focus();
              });
          });
      };
  }
]);

/* http://stackoverflow.com/questions/14833326/how-to-set-focus-in-angularjs */
app.factory('autofocus', ['$rootScope', '$timeout', function($rootScope, $timeout) {
  return function() {
      $timeout(function() {
          $rootScope.$broadcast('autofocus');
      });
  };
}]);

app.config(['$stateProvider', function ($stateProvider) {
    $stateProvider.state('main', {
        url: '/main'
    });
}]);

app.config(['$stateProvider', function ($stateProvider) {
    $stateProvider.state('main.modal', {
        url: '/modal',
        onEnter: ['$state', '$stateParams', '$modal', 'autofocus',
            function ($state, $stateParams, $modal, autofocus) {
                var …
Run Code Online (Sandbox Code Playgroud)

html5 internet-explorer modal-dialog angularjs angular-ui-bootstrap

6
推荐指数
2
解决办法
2294
查看次数

错误:[$ injector:unpr]未知提供者:modalInstanceProvider < - modalInstance < - 带最新ui引导程序的modalCtrl

编辑 - 如下面的代码,模态将工作 - 我的问题是我已经在我的模板的HTML模板中包含ng-app和ng-controller,但是它们不包括在下面的问题中.

我有我的主控制器,模态控制器和我的模态模板HTML

一切似乎都是有序的,我不能为我的生活做出工作(或从stackoverflow中找出)为什么我一直在收到Error: [$injector:unpr] Unknown provider: modalInstanceProvider <- modalInstance <- modalCtrl错误.BTW $modal现在被贬值,$ubiModal现在.

主要控制:

var module = angular.module("app", ["agGrid", "ngAnimate", "ngSanitize", "ngDialog", "ui.bootstrap"])

module.controller("mainCtrl", ["$scope", "dataService", "$timeout", "dateFilter", "ngDialog", "$http", "$uibModal", function ($scope, dataService, $timeout, dateFilter, ngDialog, $http, $uibModal) {

$scope.open = function () {

    var uibModalInstance= $uibModal.open({
        templateUrl: "views/Modal.html",
        controller: "modalCtrl",
        show: true,
    })
};
}]);
Run Code Online (Sandbox Code Playgroud)

我的模态控制器:

module.controller("modalCtrl", ["$scope", "ngDialog", "dataService", "$uibModalInstance", function ($scope, ngDialog, dataService, $uibModalInstance) {

//do stuff

}]); …
Run Code Online (Sandbox Code Playgroud)

html javascript modal-dialog angularjs angular-ui-bootstrap

6
推荐指数
1
解决办法
9991
查看次数

更改ui.bootrap的工具提示箭头的颜色(附带的plunker)

这是plunker代码. http://plnkr.co/edit/C1khFJqTUutDaK9ad7ud?p=preview

我需要更改工具提示箭头.示例中工具提示的位置是顶部,底部和左侧.

有人可以告诉我如何设置这些工具提示的样式.我需要为工具提示的不同位置以不同方式为工具提示箭头着色.

例如

tooltip at top-> arrow color should be red
tooltip at bottom-> arrow color green
tooltip at left-> arrow color yellow
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我如何获取这些类并将颜色应用于这些工具提示.

这是代码

HTML

<div ng-controller="TooltipDemoCtrl">
<br><br><br>
  <div ng-class="{'has-error' : !inputModel}">
    <input type="text" ng-model="inputModel" class="test"
      uib-tooltip="Tooltip TBD"
      tooltip-placement="top"
      tooltip-trigger="mouseenter"
      tooltip-enable="!inputModel" />
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.tooltip .tooltip-inner {
            color: white;
            background-color: blue;
            border-radius:5px;
}

.tooltip .tooltip-arrow { 
          //cant get the class for the arrow

}
Run Code Online (Sandbox Code Playgroud)

javascript css jquery angularjs angular-ui-bootstrap

6
推荐指数
1
解决办法
8625
查看次数