<p dir="auto">We have a library of components for angular that we are currently migrating to Angular 2. We have a container that injects content using <code class="notranslate">ng-content</code>. We would like to have a child component that injects the parent if you nest it inside of the parent, like so:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;parent&gt;
    &lt;child&gt;&lt;/child&gt;
&lt;/parent&gt;"><pre class="notranslate"><code class="notranslate">&lt;parent&gt;
    &lt;child&gt;&lt;/child&gt;
&lt;/parent&gt;
</code></pre></div>
<p dir="auto">This works beautifully in angular 2. However, since are in the process of migration, we would like to use the ngUpgrade adapter for this. The dependency injection seems to fail if the parent and child are specified in an angular 1 context. Any insights on this issue? Is this something that is going to be supported in the ngUpgrade adapter?</p>
<p dir="auto">I have a working plunker that illustrates the problem:</p>
<p dir="auto"><a href="http://plnkr.co/edit/9qb6ZK9SpJyrWoJDEFEj?p=preview" rel="nofollow">http://plnkr.co/edit/9qb6ZK9SpJyrWoJDEFEj?p=preview</a></p>
<p dir="auto">In both cases, the template includes a parent with the child <code class="notranslate">transcluded/projected</code> into it. The child tries to inject the parent and then calls a function on it when you press the button. The ng2 example works, but not the ng1/ngUpgrade one.</p>
<p dir="auto"><strong>I'm submitting a</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[x] bug report"><pre class="notranslate"><code class="notranslate">[x] bug report
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
I'm having a problem with when HostBindings are applied to parent elements when a child element is using a ngIf. If the child element has an ngIf then host binding of it's parents are applied after the ngAfterViewInit of the child element is called. If no ngIf they are applied before.</p>
<p dir="auto"><strong>Expected behavior</strong><br>
Parent element HostBindings are applied before the child element ngAfterViewInit regardless of whether the child element has an ngIf or not.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong></p>

<p dir="auto">See plnkr to duplicate the issue.<br>
<a href="http://plnkr.co/edit/jy5oEQNRbQ6VdqqpGJOy?p=preview" rel="nofollow">http://plnkr.co/edit/jy5oEQNRbQ6VdqqpGJOy?p=preview</a></p>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong></p>

<p dir="auto"><strong>Please tell us about your environment:</strong></p>

<ul dir="auto">
<li>
<p dir="auto"><strong>Operating system:</strong> Window7</p>
</li>
<li>
<p dir="auto"><strong>IDE:</strong> Intellij 2016.3.4</p>
</li>
<li>
<p dir="auto"><strong>package manager:</strong> npm 3.10.10</p>
</li>
<li>
<p dir="auto"><strong>HTTP server:</strong> angular-cli server</p>
</li>
<li>
<p dir="auto"><strong>Angular version:</strong> 2.4.8</p>
</li>
</ul>

<ul dir="auto">
<li><strong>Browser:</strong> all</li>
</ul>

<ul dir="auto">
<li>
<p dir="auto"><strong>Language:</strong> TypeScript 2.0.10</p>
</li>
<li>
<p dir="auto"><strong>Node (for AoT issues):</strong> <code class="notranslate">node --version</code> =</p>
</li>
</ul>