1

How can I use angular.element instead of jQuery ($) for this block of code?

<form style="display: none" action="{! $page.FormMigrateDownload}" method="POST" id="jsonDownloadForm">
  <input type="hidden" id="appFormJsonData" name="appFormJsonData" value="" />
  <input type="hidden" id="jsonFileName" name="jsonFileName" value="" />
</form>
$scope.download = function(form) {
  $("#appFormJsonData").val(JSON.stringify(form));
  $("#jsonFileName").val('"TX-' + form.Name + '.json"');
  $("#jsonDownloadForm").submit();
};

2 Answers 2

1

you can use like

> angular.element('#appFormJsonData').val(); OR
> angular.element('#appFormJsonData')[0].value;
Sign up to request clarification or add additional context in comments.

Comments

0

Hi and welcome on StackOverflow

angular.element is simply a wrapper for jQuery (or jqLite if you didn't install jQuery) so you can use it as if you were using jQuery.

Read more in the API docs of AngularJS

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.