javascript - angular, do stuff after ng-show -
im populating page angular controller (with ajax) , using ng-show show stuff in steps. problem need resize height of background after ng-show has shown elements. how do that?
the function in controller looks this
$scope.showproducts = function () { $http({ method: 'get', url: 'myurl' }). success(function(data) { $scope.productvisible = true; $scope.products= data; //here recalculate height of document hasn't shown products yet }); };
the html this:
<li ng-repeat="product in products" ng-show="productvisible"> {{product.productname}} </li>
use watch
subscribe alter gets reflected:
$scope.$watch('productvisible', function (newval, oldval) { if(newval){ //change height here } }, true);
javascript angularjs angularjs-scope
No comments:
Post a Comment