javascript - How to toggle visibility in AngularJS based on the text content of the element? -
imagine have next html:
<p id="message" ng-show="something"></p>
now during lifetime of page #message
can filled text message after ajax call.
i #message
to toggle visible/hidden based on if contains or not.
something like:
<p id="message" ng-show="self.text != ''"></p> <!--not working thought -->
my best suggestion bind content of #message scope variable.
<p id="message" ng-show="content != ''">{{content}}</p>
then need update value of $scope.content alter both contents of #message , visibility.
javascript angularjs
No comments:
Post a Comment