So, to frame this appropriately, I am inheriting a codebase here and I don't have a deep knowledge of angular. Basically there's an application that shows or hides a loading gif based on whether or not a database import has finished.
For some reason though, despite the fact that the dataset import has finished angular does not recognize it. Simplified code sample below:
<h4>Status
<small ng-hide="dataset.failed">{{ dataset.status }}</small>
<img class="pull-right" ng-hide="(dataset.import_complete || dataset.failed)" src="/url" height="12">
</h4>
<span>{{ dataset.import_complete }}</span>
The span I added in for debugging purposes, but essentially the span shows True
, while the img
tag above is still being displayed. This implies that angular is evaluating dataset.import_complete || dataset.failed
to False
instead.
Why would this happen? Any suggestions to helping debug this behavior would be hugely appreciated.
Updates: I think the thought here is that some faulty type-checking is happening here. Specifically the following appear to be true:
# Always evaluates to True, regardless of import_complete
dataset.import_complete == True
# Always evaluates to False, again, regardless of import_complete
dataset.import_complete == 'True'
# result is bool, as it should be, making this only more baffling
type(dataset)
Also, here's a bit of the backend, but probably not very helpful:
@route(bp, '/dataset/<int:dataset_id>', methods=["GET", "POST"])
def dataset(dataset_id): """Returns the dataset management page"""
dataset = Dataset.query.get_or_404(dataset_id)
return render_template(
'manage/dataset.html',
dataset=dataset,
)
And for more info, here's the output of vars(dataset)
:
{'import_complete': True, 'failed': False, 'pending_deletion': False}
{{dataset}}
` output? Also it's worth posting what's the Flask backend is sending to the Angular frontend – bakkal Apr 30 '16 at 20:03