# Template projected into slot breaks children bind

**URL:** https://discourse.aurelia.io/t/template-projected-into-slot-breaks-children-bind/1241
**Category:** Help Requests
**Created:** [May 22, 2018, 9:00pm UTC](https://discourse.aurelia.io/t/template-projected-into-slot-breaks-children-bind/1241 "2018-05-22T21:00:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hlampert](https://avatars.discourse-cdn.com/v4/letter/h/e19adc/32.png) [@hlampert](https://discourse.aurelia.io/u/hlampert)
#### Post date: [May 22, 2018, 9:00pm UTC](https://discourse.aurelia.io/t/template-projected-into-slot-breaks-children-bind/1241/1 "2018-05-22T21:00:35Z")

</div>

Found a strange behavior when using `if.bind` inside a nested template tag that is itself projected into a component’s slot.

Basically the html structures below:

app.html

```auto
<template>
  <component>
    <template>
      <div if.bind="expr">
      </div>
    </template>
  </component>
</template>

```

component.html

```auto
<template>
  <slot></slot>
</template>

```

(I omitted a `if.bind` on the nested template tag that is required otherwise that tag never renders, it would be interesting to know why this requirement exists, but it is not the main question)

The binding only works (as in 'dynamically updates according to the current value of `expr`') if `expr` initially resolves to `false`, if it initially resolves to `true` the binding seems to be ignored.

gist:

> **[Bring your Gists to life with GistRun](https://gist.run/?id=ea0a6def2a30915aa734bfafdd007575)**
>
> GistRun is a site for running, creating and updating GitHub Gists. With GistRun you can easily share Gists on StackOverflow.

I was wondering why that happens? Can templates be used like this?

Thanks.

---

<div class="post-metadata">

### Author: ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)
#### Post date: [May 22, 2018, 11:16pm UTC](https://discourse.aurelia.io/t/template-projected-into-slot-breaks-children-bind/1241/2 "2018-05-22T23:16:55Z")

</div>

There is a known issue around using repeat.for (and/or if.bind) back to back on `<template>` tag. `<template>` tag is special in Aurelia, it doesn’t create real DOM node.

The easy fix is to not use `<template>` with if.bind, change it to `<div if.bind="a">` or `<some-tag if.bind="a">`.

BTW, your html is not correct, you paired `<div>` with `</span>`. Please use a lint tool (like htmlhint) in your editor.

[https://github.com/aurelia/templating-resources/issues/265](https://github.com/aurelia/templating-resources/issues/265)
