javascript - Directive template update when scope property updates -
i have component i'm trying build accepts user_id
, loads user information in background, , drops element on page directive attached it.
so far have
<user-popover user-id="item.item_high_bid_user_id"></user-popover> angular.module('bidradminapp') .directive('userpopover', ['data', function (data) { return { template: '<a bb-popover-template="user-popover-content.html">{{user.user_name}}</a><i ng-hide="{{user}}" class="fa fa-spinner fa-spin" aria-hidden="true"></i>', scope: { userid: '=', user: '=*' }, restrict: 'e', controller: function($scope, $element, $attrs, data){ data.getuser($scope.userid).then(function(userdata){ $scope.user = userdata.data; }); }, }; }]);
i'm getting data loading in background data
service , user.user_name
in template gets updated correctly, issue spinner not being hidden when $scope.user
gets updated. how can spinner hide once user data has been loaded in , rest of template has been updated.
update
i need mention here these directives show in repeating grid of items, directive intended act sort of user hover card, similar facebook when hover on , popover information user, each iteration of directive able stand on own, stands loading indicator hides after directives have finished loading $scope.user
property.
you try:
ng-hide="user.user_name.length > 0"
Comments
Post a Comment