javascript - Angular UIBootstrap popover error - Stack Overflow

Getting an example from and following instructions I did :<button popover="I appeared on mous

Getting an example from / and following instructions I did :

<button popover="I appeared on mouse enter!" popover-trigger="mouseenter" class="btn btn-default">Mouseenter</button>

and when I moved mouse over button I got:

  1. Uncaught TypeError: Cannot read property 'split' of undefined ui-bootstrap-tpls-0.11.2.min.js:8
  2. positionElementsui-bootstrap-tpls-0.11.2.min.js:8
  3. zui-bootstrap-tpls-0.11.2.min.js:9
  4. pui-bootstrap-tpls-0.11.2.min.js:9
  5. kui-bootstrap-tpls-0.11.2.min.js:9
  6. b.event.special.(anonymous function).handlejquery.min.js:4
  7. b.event.dispatchjquery.min.js:3
  8. v.handlejquery.min.js:3

There I found an instruction : "The popover directives require the $position service." But have no idea what does it mean. I am a beginner so please help me. Maybe some initialization needs? I cannot find it on official website

Getting an example from http://angular-ui.github.io/bootstrap/ and following instructions I did :

<button popover="I appeared on mouse enter!" popover-trigger="mouseenter" class="btn btn-default">Mouseenter</button>

and when I moved mouse over button I got:

  1. Uncaught TypeError: Cannot read property 'split' of undefined ui-bootstrap-tpls-0.11.2.min.js:8
  2. positionElementsui-bootstrap-tpls-0.11.2.min.js:8
  3. zui-bootstrap-tpls-0.11.2.min.js:9
  4. pui-bootstrap-tpls-0.11.2.min.js:9
  5. kui-bootstrap-tpls-0.11.2.min.js:9
  6. b.event.special.(anonymous function).handlejquery.min.js:4
  7. b.event.dispatchjquery.min.js:3
  8. v.handlejquery.min.js:3

There I found an instruction : "The popover directives require the $position service." But have no idea what does it mean. I am a beginner so please help me. Maybe some initialization needs? I cannot find it on official website

Share asked Nov 5, 2014 at 7:13 Lagoda DenisLagoda Denis 2255 silver badges13 bronze badges 2
  • Are using full package or custom created by choose create a build? – Krzysztof Safjanowski Commented Nov 5, 2014 at 7:24
  • Yes -I use a full package : <script type="text/javascript" src="../vendor/ui-bootstrap/ui-bootstrap-tpls-0.11.2.min.js"></script> – Lagoda Denis Commented Nov 5, 2014 at 7:51
Add a ment  | 

3 Answers 3

Reset to default 6

Specifying popover-placement fixed the problem for me.

Example:

<input type="number"
       popover-placement="top"
       popover="This is some text that explains something"
       popover-trigger="focus">

There seems to be a problem with placement/position of tooltips, and popovers. It has something to do with the changes to angular.isDefined which works differently in AngularJS 1.2 & 1.3

Here are a few directives to patch the issues by setting defaults

        // Bootstrap UI fixes after upgrading to Angular 1.3
        .directive('tooltip', function() {
            return {
                restrict: 'EA',
                link: function(scope, element, attrs) {
                    attrs.tooltipPlacement = attrs.tooltipPlacement || 'top';
                    attrs.tooltipAnimation = attrs.tooltipAnimation || true;
                    attrs.tooltipPopupDelay = attrs.tooltipPopupDelay || 0;
                    attrs.tooltipTrigger = attrs.tooltipTrigger || 'mouseenter';
                    attrs.tooltipAppendToBody = attrs.tooltipAppendToBody || false;
                }
            }
        })

        .directive('popover', function() {
            return {
                restrict: 'EA',
                link: function(scope, element, attrs) {
                    attrs.popoverPlacement = attrs.popoverPlacement || 'top';
                    attrs.popoverAnimation = attrs.popoverAnimation || true;
                    attrs.popoverPopupDelay = attrs.popoverPopupDelay || 0;
                    attrs.popoverTrigger = attrs.popoverTrigger || 'mouseenter';
                    attrs.popoverAppendToBody = attrs.popoverAppendToBody || false;
                }
            }
        })

Perhaps you are using angular 1.3.1 that breaks popover, angular 1.3.0 works

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744923055a4601254.html

相关推荐

  • javascript - Angular UIBootstrap popover error - Stack Overflow

    Getting an example from and following instructions I did :<button popover="I appeared on mous

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信