angularjs tooltip: tooltip html template not updating

无人久伴 提交于 2019-12-12 03:59:41

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/32842839/angularjs-tooltip-tooltip-html-template-not-updating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!