Search code examples
javascriptangularjstooltip

angularjs tooltip: tooltip html template not updating


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?


Solution

  • 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.