neiza neiza - 1 year ago 77
JSON Question

Show a region on page if data from json equal to true with Ionic and Angular

I'm creating an ionic app and there are variables I request from a php page through the Ionic controller. From the variables I get, I have a field called

which either be
for each user after log on.
What I want to achieve is, there is a div on the page called "activediv" and I want that div show only if the variable from the json = yes.

.controller('useraccount_ctrl', ['$scope', '$http', function($scope, $http) {
$http.get('http://localhost/myapp/app_ion/templates/user/user_account.php').success(function(data) {
$scope.userdata = (data);


<ion-content class="has-subheader">

<ion-list class="list card" ng-repeat="item in userdata">
<ion-item href="#/tab/source/{{item.profile_id}}">
<div class="item item-avatar-big">
<img src="../usr_up_img/{{item.profile_pix}}">
<div id="activediv">{{}}</div>



[{"fname":"Nicholas","country":"India","curr_city":"East Legon","profile_id":"1298","profile_pix":"173333297082.jpg","active":"yes"}]

Answer Source

Try this

<div id="activediv" ng-if =" == 'yes'">{{}}</div>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download