-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PT-14394: AngularJS error when user open GenericExport (#83)
fix: Error Expected array but received when user open Generic Export blade.
- Loading branch information
Showing
4 changed files
with
181 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/VirtoCommerce.ExportModule.Web/Scripts/filters/toArrayFilter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
angular.module('angular-toArrayFilter', []) | ||
.filter('toArray', function () { | ||
return function (obj, addKey) { | ||
if (!angular.isObject(obj)) return obj; | ||
if (addKey === false) { | ||
return Object.keys(obj).map(function (key) { | ||
return obj[key]; | ||
}); | ||
} else { | ||
return Object.keys(obj).map(function (key) { | ||
var value = obj[key]; | ||
return angular.isObject(value) ? | ||
Object.defineProperty(value, '$key', { enumerable: false, value: key }) : | ||
{ $key: key, $value: value }; | ||
}); | ||
} | ||
}; | ||
}); |
Oops, something went wrong.