Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8762445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:31:56+00:00 2026-06-13T15:31:56+00:00

All, we’re developing a webapp with AngularJS and we have a use case/requirement (that

  • 0

All, we’re developing a webapp with AngularJS and we have a use case/requirement (that won’t happen very often at all) where we will need to retrieve a complete HTML document from our static server. However, it appears that the $http object returns a raw HTML string as its ‘data’. We are trying to avoid using an external library (like jQuery, for instance), but we need to parse that raw HTML string into a queriable DOM object. We could use an iframe and be done with it, but we’re also trying to avoid using iframes for well-known reasons.

So, the question is: does AngularJS have a parser for HTML (as it does for JSON)? Or else, what’s the most graceful way to handle this case?

P.S.: We tried sifting through Angular’s API docs, but in all honesty they are hit-or-miss and unintuitive to navigate around.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:31:57+00:00Added an answer on June 13, 2026 at 3:31 pm

    If you need to get a DOM element from the string programmatically, parsing html into a DOM object is pretty simple.

    Basically you’d use DOMParser.

    var parser = new DOMParser();
    var doc = parser.parseFromString('<div>some html</div>', 'text/html');
    doc.firstChild; //this is what you're after.
    

    From there if you wanted to query to get elements from it with vanilla JS (meaning, you don’t want to use JQuery for some reason), you can do this:

    //get all anchor tags with class "test" under a div.
    var testAnchors = doc.firstChild.querySelectorAll('div a.test'); 
    

    … but note: querySelectorAll is only supported in IE8 and higher.

    EDIT: additional approach…

    The “wrap” method:

    var div = document.createElement('div');
    div.innerHTML = '<div>some html</div>';
    var result = div.childNodes;
    

    … do note that this method will return HTMLUnknownElements if you put SVG or MathML into it. They’ll “look” normal, but they won’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All of a sudden I must have changed something in my app that causes
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
All the examples of use and tutorials I have found on beginBackgroundTaskWithExpirationHandler: show how
All, I have a form with a MultiValueField that almost works. It uses a
All the guys probably will recommend that I read the follow previously question in
All, I have some script tags that are not working in Wordpress. If I
All too often I want a WPF slider that behaves like the System.Windows.Forms.TrackBar of
All, I currently have two projects that are under SourceSafe that I am unable
All of the guides and tutorials that I have read tell me to do
All -- I have these two methods in one of my classes: public static

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.