ng-inspector
ng-inspector copied to clipboard
date within variable is not displayed
It seems to me that whenever I have a JavaScript date in a scope variable, ng-inspector will display an icon for {} (object) in the right panel (Chrome 39), but when I try to open it, it will remain blank. However, if I click on the icon, it will log the date in the console. Can you confirm this bug? Is this intended behaviour?
Hey @dmvianna, thanks for the report!
- plnkr to replicate: http://plnkr.co/edit/wHjyBEHjNn70eH42L5ky?p=preview
I definitely wouldn't consider this intended behavior -- just something we haven't noticed before :)
At the moment, the following code is driving this:
// Object
else if (angular.isObject(value)) {
this.view.setType('ngi-model-object');
var length = Object.keys(value).length;
if (length === 0) {
valSpan.textContent = '{ }';
} else {
valSpan.textContent = '{...}';
this.view.setIndicator(length);
}
this.view.makeCollapsible(true, true);
this.update(value, depth.concat([this.value]), Model);
}
Since angular.isObject is true on Date objects, it's currently just treating Date's as POJO's.
We should probably just add an additional case for angular.isDate(value), and then render a string representation of the date.
@rev087 Interested in whipping up an icon for dates?
@DrewML will do
Promise (#143) and Date icons added to repo.