> For the complete documentation index, see [llms.txt](https://docs.aurelia.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aurelia.io/developer-guides/error-messages/runtime-html/aur0805.md).

# AUR0805

## Error Message

`AUR0805: Invalid scope behavior "<value>" on <au-compose />. Only "scoped" or "auto" allowed.`

Where `<value>` is the invalid value provided to the `scope-behavior` attribute.

## Description

This error occurs when using the `<au-compose>` element and providing an invalid value for the `scope-behavior` bindable attribute. This attribute controls how the binding context (scope) is passed to the composed component or template.

## Cause

The error is caused by setting the `scope-behavior` attribute on an `<au-compose>` element to a string value other than the two allowed options:

* `'auto'` (Default): The composed component inherits the outer scope (the scope of the template where `<au-compose>` is used).
* `'scoped'`: The composed component receives a new scope, with the `bindingContext` of `<au-compose>` becoming the `$parent` scope for the composed component. The `scope` property of `<au-compose>` (if provided) is used as the binding context for the composed component.

Providing any other string (e.g., `'inherit'`, `'none'`, a typo) will result in this error.

## Solution

1. **Use Valid Values:** Ensure the value provided to the `scope-behavior` attribute is either the string `'auto'` or the string `'scoped'`.
2. **Check Binding:** If `scope-behavior` is dynamically bound (e.g., `scope-behavior.bind="myScopeSetting"`), ensure the view model property (`myScopeSetting`) always resolves to either `'auto'` or `'scoped'`.
3. **Use Default:** If you want the default behavior (`'auto'`), you can simply omit the `scope-behavior` attribute.

## Example

```html
<!-- Assume 'my-component' is a registered component -->
<!-- Assume 'currentScope' and 'componentViewModel' are properties on the parent view model -->

<!-- Incorrect: 'inherit' is not a valid value -->
<au-compose component="my-component" scope-behavior="inherit"></au-compose>

<!-- Incorrect: Typo -->
<au-compose component="my-component" scope-behavior="scped"></au-compose>

<!-- Correct: Explicitly using the default 'auto' behavior -->
<au-compose component="my-component" scope-behavior="auto"></au-compose>

<!-- Correct: Using 'scoped' behavior -->
<!-- 'my-component' will have 'componentViewModel' as its binding context -->
<!-- The parent scope will be available as $parent inside 'my-component' -->
<au-compose component="my-component"
                  scope.bind="componentViewModel"
                  scope-behavior="scoped">
</au-compose>

<!-- Correct: Omitting the attribute uses the default 'auto' -->
<au-compose component="my-component" model.bind="componentViewModel"></au-compose>
```

```typescript
// Parent View Model
import { customElement } from 'aurelia';

@customElement({ /* ... */ })
export class ParentComponent {
  componentViewModel = { message: 'Data for composed component' };
  // Example for dynamic binding (ensure it's 'auto' or 'scoped')
  scopeSetting: 'auto' | 'scoped' = 'scoped';
}

// Composed Component View Model (my-component.ts)
import { bindable, customElement } from 'aurelia';

@customElement({ name: 'my-component', template: `<p>\${message} | Parent: \${$parent?.constructor.name}</p>` })
export class MyComponent {
  @bindable message: string;
}
```

## Debugging Tips

* Verify the spelling of the value passed to `scope-behavior` in your template. Remember it's case-sensitive.
* If the value is bound, log the value of the corresponding view model property right before `<au-compose>` renders.
* Consult the `<au-compose>` documentation for a clearer understanding of how `'auto'` and `'scoped'` behaviors affect the binding context.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aurelia.io/developer-guides/error-messages/runtime-html/aur0805.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
