I've hit a snag and I'm hoping you guys can help:
I have a basic HTTP get in Angular - I've done it 100 times at this point. My JSON response on the server, confirmed, is formed like so:
[{"date":"07\/24\/2017","time_start":"02:00 PM","time_end":"05:00 PM","name":"Adult Ministries Registration","room":"","speaker":"none","speaker_writein":"","xhead":"yes"}]
You see the final property is "xhead" and it's a string "yes" or "no" - which I'm using to determine when to show titles that break up events by day (grouping them by time under a date in a schedule list).
The problem for me is that when this data comes into the Angular app, "xhead" is undefined. I'm doing a simple console.log on the response data and it shows as undefined.
Even more odd is that if I change these values to 1 or 0, they all come into Angular as either 1 or 0 - not differentiated as they should be for each item in the collection (response).
When i visit the endpoints in the browser, the data is as it should be.
Help!!! I'm losing my mind.
It appears as though using ng-if="response.xhead=yes" in the view changes the value of the item. That was the problem.
The ngIf directive removes or recreates a portion of the DOM tree based on an {expression}. If the expression assigned to ngIf evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.