angularjs - Issue with ngShow -
i have following problem ngshow. receive response json $http.get , construct several dom elements using ngrepeat. working properly. controller apply:
$http.get(requesturl).success(function (data) { $scope.results = data.results; });
data.results object this:
{ "someprop": ["item1", "item2", "item3"], "someprop1": ["item1", "item2", "item3"] }
from template try use ngshow this:
<table ng-show="object.keys(results).length > 0">
and this:
<table ng-show="object.keys($scope.results).length > 0">
with no luck.
<table ng-show="true">
and
<table ng-show="false">
working properly.
so seems problem in expression. grateful help.
it not evaluate object.keys
function inside of expression not located on scope. 1 way can around assigning object
scope.
$scope.object = object;
and inside view
<div ng-show="object.keys(results).length > 0"> {{object.keys(results).length}} </div>
Comments
Post a Comment