angularjs tooltip: tooltip html template not updat

2019-09-11 11:52发布

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条回答
戒情不戒烟
2楼-- · 2019-09-11 12:27

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.

查看更多
登录 后发表回答