Question: In my angular application I have two urls: `localhost:4200/report/11/view` and `localhost:4200/report/11/edit`.

In view page I divide the areas to components like this:
 --> render h2 with title.
 -> render ul-li with list of companies belong to this report.
 -> render p.

In my edit page I make those component editable:
 --> render input with title.
 -> render ul-li with list of companies belong to this report, and autocomplete to add to the list.
 -> render input.

My question is should I use seperate components for view and edit or inside the component I use ngIf to display or not the right part?

Answer: 
The reason it doesn't work the way you tried is explained in the jQuery [documentation](https://api.jquery.com/jQuery/#jQuery2):

> 
> If the HTML is more complex than a single tag without attributes, as it is in the above example, the actual creation of the elements is handled by the browser's `.innerHTML` mechanism. In most cases, jQuery creates a new `<div>` element and sets the `innerHTML` property of the element to the HTML snippet that was passed in.
> 
> 
> 

Since you can't have a `<body>` inside a `<div>`, the browser ignores the `<body>` tag.

The documentation goes on to say:

> 
> When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, jQuery uses the browser's `.innerHTML` property to parse the passed HTML and insert it into the current document. During this process, some browsers filter out certain elements such as `<html>`, `<title>`, or `<head>` elements. As a result, the elements inserted may not be representative of the original string passed.
> 
> 
>
The following jQuery Won't work:

```
$(data).find('sustainable');

```

as the divs are top level elements and data isn't an element but a string, to make it work you need to use .filter

```
$(data).filter('sustainable.wrap');

```