angularjs提示:提示HTML模板没有更新 [英] angularjs tooltip: tooltip html template not updating

查看:232
本文介绍了angularjs提示:提示HTML模板没有更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这angularjs提示库显示工具提示。

下面是我的 HTML

 <跨度工具提示工具提示标题=条引荐提示出现触发=点击工具提示视图=/静态/模板/提示/ recommenders.htmltooltip-视图CTRL =FeedCtrl>< / SPAN>

下面是我的工具提示部分:

 < D​​IV NG重复=,在recommenders_list推荐>
    {{推荐}}
< / DIV>

我现在面临的问题是,当我在我的控制器更新recommenders_list'阵,同样是不反映在提示模板。
如何更新我的工具提示部分?


解决方案

  

mainFile


 使用严格的;angular.module('yourAppName')
    .controller('ControllerName',['$范围,功能(适用范围){        // ...
        //此处是您名单
        // ...
    }]);


  

directiveFile


  angular.module('yourAppName')
    .directive('directiveName',函数(){
        返回{
            templateUrl:URL /的/你/ template.html
        };
    });


  

HTMLFILE
  


 <机身NG-应用=yourAppName>    < D​​IV CLASS =集装箱液NG控制器=ControllerName>
        < D​​IV指令-名称>< / DIV>
    < / DIV>    &所述;! - 角文件 - >
    <脚本SRC =JS / angular.min.js>< / SCRIPT>
    <! - 角mainFile - >
    <脚本SRC =URL /的/你/ mainFile.js>< / SCRIPT>< /身体GT;

看看这个例子,是很基本的,但这种方式我希望你能理解并找到可能是你的问题。

I was using this angularjs tooltip library to show tooltips.

Here's my HTML:

<span tooltips tooltip-title="Recommenders" tooltip-show-trigger="click" tooltip-view="/static/templates/tooltips/recommenders.html" tooltip-view-ctrl="FeedCtrl"></span>

Here's my tooltip partial:

<div ng-repeat="recommender in recommenders_list">
    {{recommender}}
</div>

The problem I am facing is that when I update the 'recommenders_list' array in my controller, the same is not reflected in the tooltip template. How can I update my tooltip partial?

解决方案

mainFile

'use strict';

angular.module('yourAppName')
    .controller('ControllerName', ['$scope', function (scope) {

        // ...
        // here your list
        // ...
    }]);

directiveFile

angular.module('yourAppName')
    .directive('directiveName', function() {
        return {
            templateUrl : 'url/of/your/template.html'
        };
    });

htmlFile

<body ng-app="yourAppName">

    <div class="container-fluid" ng-controller="ControllerName">
        <div directive-name></div>
    </div>

    <!-- Angular file -->
    <script src="js/angular.min.js"></script>
    <!-- Angular mainFile -->
    <script src="url/of/your/mainFile.js"></script>

</body>

look at this example, is really basic but in this way i hope you can understand and find where could be your problem.

这篇关于angularjs提示:提示HTML模板没有更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆