Skip to content

Commit

Permalink
feat(google): move display logic to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarulg committed Oct 18, 2024
1 parent eee7e78 commit 244ca86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</td>
<td>
<textarea class="form-control input input-sm" ng-model="pair.value" rows="4">
{{ typeof pair.value === 'object' ? JSON.stringify(pair.value, null, 2) : pair.value }}
{{ $ctrl.formatValueForDisplay(pair.value) }}
</textarea
>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ angular
this.onChange();
};

this.isInvalidJson = (value) => {
try {
JSON.parse(value);
return false;
} catch {
return true;
this.formatValueForDisplay = (value) => {
if (typeof value === 'object') {
return JSON.stringify(value, null, 2);
}
return value;
};

// Clears existing values from model, then replaces them
Expand Down

0 comments on commit 244ca86

Please sign in to comment.