AUR0754

Error Message

AUR0754: Attribute <attribute-name> is not registered in <component-name>.

Where <attribute-name> is the name of the template controller attribute used (e.g., if, repeat), and <component-name> is the name of the component whose template is being rendered.

Description

This error occurs during rendering when Aurelia encounters a template controller attribute (e.g., <div if.bind="condition">, <div repeat.for="item of items">), but it cannot find the definition for that specific template controller within the resources registered for the current component or globally.

Cause

While the built-in template controllers (if, else, repeat.for, switch, case, default-case, promise.resolve, pending, then, catch, portal) are usually available by default when using the StandardConfiguration or DefaultComponents, this error can still occur if:

  1. Minimal Configuration: You are using a minimal Aurelia configuration (e.g., Aurelia.register()) that does not include the standard template controllers, and you haven't registered them manually.

  2. Custom Template Controller Issues:

    • Missing Import: A custom template controller class was not imported.

    • Missing dependencies: The imported custom template controller was not added to the dependencies array.

    • Typo: The name used in the template (e.g., my-repeater.for) doesn't match the registered name.

    • Incorrect Registration: A custom template controller wasn't registered correctly.

  3. Build/Bundling Issues: The necessary template controller definitions (standard or custom) are not being included in the final build.

Solution

  1. Use Standard Configuration: Ensure you are registering the StandardConfiguration or DefaultComponents when bootstrapping Aurelia if you intend to use the built-in template controllers.

    import Aurelia, { StandardConfiguration } from 'aurelia';
    
    Aurelia
      .register(StandardConfiguration) // Includes default template controllers
      .app(MyApp)
      .start();
  2. Register Manually (Minimal Config): If using a minimal setup, explicitly register the template controllers you need.

    import Aurelia from 'aurelia';
    import { IfRegistration, RepeatRegistration } from '@aurelia/runtime-html'; // Example imports
    
    Aurelia
      .register(
        IfRegistration, // Register 'if' and 'else'
        RepeatRegistration // Register 'repeat.for'
        // ... other needed registrations
      )
      .app(MyApp)
      .start();
  3. For Custom Template Controllers:

    • Import: Import the controller class.

    • Add to Dependencies: Include it in the dependencies array of the component using it.

    • Verify Name: Check the name in the template against its definition.

    • Check Registration: Ensure correct local or global registration.

  4. Verify Build: Check the build/bundler configuration.

Debugging Tips

  • Confirm which configuration preset (StandardConfiguration, etc.) you are using during bootstrap.

  • If using a minimal configuration, verify that all necessary template controllers (built-in or custom) are explicitly registered.

  • For custom template controllers, follow the same debugging steps as for custom elements (AUR0752) and attributes (AUR0753): check imports, dependencies, names, and build output.

Last updated

Was this helpful?