Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 角度引导工具提示不显示_Angularjs_Angular Ui Bootstrap - Fatal编程技术网

Angularjs 角度引导工具提示不显示

Angularjs 角度引导工具提示不显示,angularjs,angular-ui-bootstrap,Angularjs,Angular Ui Bootstrap,这是我的代码: .directive('mydir', function mydir() { 'use strict'; return { restrict: 'A', link: function(scope, elem, attrs) { elem.attr('tooltip', 'hello'); }); } }; }) ; 当html呈现时,工具提示属性出现在

这是我的代码:

.directive('mydir', function mydir() {
    'use strict';
    return {
        restrict: 'A',
        link: function(scope, elem, attrs) {
                elem.attr('tooltip', 'hello');
            });
        }
    };
})
;

当html呈现时,工具提示属性出现在其上,但工具提示不会出现在悬停状态。但是,如果我将tooltip属性硬编码到元素上,工具提示将显示为悬停状态。我做错了什么?

@Betty St说你需要在工具提示函数中提供选项,你不应该设置属性和使用编译函数,因为根据你的代码范围不是必需的

代码


谢谢。

为什么不像这样添加工具提示。工具提示{title:'hello'},不需要设置属性。
.directive('mydir', function mydir() {
    'use strict';
    return {
        restrict: 'A',
        compile: function(elem, attrs) {
                elem.tooltip({title: 'hello'});
            });
        }
    };
});