emberjs / emberjs/ember.js

Private properties are inaccessible from the <template> region

Open
#21,007 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

### 🐞 Describe the Bug

[Repro](https://limber.glimdown.com/edit?c=JYWwDg9gTgLgBAYQuCA7Apq%2BAzKy4DkAAgOYA2oI6UA9AMbKQZYEDcAUKJLHAN5wwoAQzoBrdABM4AXzi58xcpWo1BI0cFQk2nFD35oZcvCEJF0IAEYqQECcGzBqO9ugAe3eBPTYhAVzJ4OjIhAGdQuAAJdDIyCAB1aDIpdxhMCQikFGZ4XnY4OCI1MUk4Bj8sOABeOAAGDny4AGJNOigLTHgagAoASmqAPgEAC2BQgDpyyoBqGoBGBoKAHjTwELSBxuWwAYBNCD84YaEAN3QyihKpGGHzyz8YGENeXhuxyYOsaVkYUHQJpY0HbsLZwJb3R6GGAATzA6CqACIIU9UAi%2BLxDAjgsAxGi3hMWqg2h0vtIBghLqJAci0JtlqoLGB1uhNtJ2EA&format=gjs)

I expect this to work:
```gjs
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { on } from '@ember/modifier';

export default class HelloWorld extends Component {
@tracked count = 0;

#increment = () => this.count += 1;


You have clicked the button {{this.count}} times.

Click

}
```

but instead we get an implicit undefined replacement

when used wit the `on` modifier, you get this error:
```
can't access property "bind", userProvidedCallback is undefined
```

but if you use a property in the template, i.e.: `{{this.#foo}}`, undefined renders, and nothing tells you anything is wrong

### 🌍 Environment

- Ember: 6.8.x

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.