I was having trouble with an ng-repeat
, where values which I expected to be set are not.
So, I added a few lines of debug, showing some values in the HTML of my current view.
Given
<div ng-hide="campaignDataEmpty" ng-repeat="campaign in campaigns" ng-click="CampaignClicked($event, campaign.campaign_id)">
Can I debug by <p>{{campaign}}</p>
, given that campaign
is a loop control variable, rather than a $scope
variable?
I originally wanted to debug a single field of the object campaign
, so added
<p>{{campaign.campaign_id}}</p>
, which displayed correctly. Then I wanted to see more fields, so added a <p>{{campaign}}</p>
, without removing the previous statement.
What I find is that, no matter whether I
<p>{{campaign}}</p>
<p>{{campaign.campaign_id}}</p>
or
<p>{{campaign.campaign_id}}</p>
<p>{{campaign}}</p>
The first always displays correctly and the second always appears to be empty.
What am I doing wrongly?
campaign
variable if you're trying inside the repeater. Outside of it it wouldn't exist. – casraf 2 mins ago