Comments (5)
It looks like there are 2 different things being discussed here:
- the usage of the
@Attribute
/HostAttributeToken
- one-time bindings for improving performance
To start with, @Attribute
/ HostAttributeToken
are there to retrieve static attributes. Those mechanisms are not meant to replace / substitute for inputs. In this sense we do not want to add mechanisms known from inputs here, ex.: attribute values are always strings so there is no reason to talk about types or transforms. When such facilities are needed one should use inputs.
I can understand the worry that adding inputs for "static" attributes might come with the "unnecessary perf penalty" and this is here we've got #14033 open.
Ultimately, after the above explanations, I think that this is a duplicate of #14033
from angular.
@pkozlowski-opensource
Autocompleting property name (which has marked by HostAttributeToken
) in template.
Such as
@Component({selector: 'child-with-attributes'})
class ChildComponent {
public color = inject(new HostAttributeToken('color'));
}
@Component({
template: `
<child-with-attributes co... /> // here we get hint: color=""
`
})
class ParentComponent {}
or visually:
![Screenshot 2024-06-20 at 15 30 10](https://private-user-images.githubusercontent.com/75264285/341410073-d7f22532-edeb-496b-a67a-4412e16c1e11.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0NjgxODIsIm5iZiI6MTcyMTQ2Nzg4MiwicGF0aCI6Ii83NTI2NDI4NS8zNDE0MTAwNzMtZDdmMjI1MzItZWRlYi00OTZiLWE2N2EtNDQxMmUxNmMxZTExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIwVDA5MzEyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA4Y2NjY2M5MjQwNTJlMmI1NWRiZmY2NTFhYWMxMmJmNjI3NjkwZWMwMTcxOWVhMmM1NWIyYzIyYWFhM2QwOTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.xsbmOO2Zb3yAr9_IGrrbLAiQQOItQbpf3RmmeHqYZGw)
from angular.
@pkozlowski-opensource thanks for clarification. Sorry for messed explanation.
The main point was adding property intellisense for @Attribute
/ HostAttributeToken
in templates.
Will it make sense to open PR with this scope only at language-service
?
from angular.
The main point was adding property intellisense for @Attribute / HostAttributeToken in templates.
Will it make sense to open PR with this scope only at language-service?
Depending on what you've got in mind in terms of intellisense
from angular.
@pkozlowski-opensource is aforementioned feature appropriate framework-wise for implementing in language service?
from angular.
Related Issues (20)
- The inherited component cannot be fully destroyed. HOT 2
- TypeError: Cannot set property 'nodeValue' of undefined HOT 1
- registerOnValidatorChange not called when bind in template form on the form element
- numberAttribute transform is not working when passing null HOT 3
- Support for Opening URLs in New Tab with State in Angular Router HOT 2
- UrlMatcher no longer receives the full url SegmentGroup after redirect HOT 2
- Improve misleading error message for control flow when HTML close tags are missing
- toSignal's runtime error message does not get tree shaken away in prod build
- Suggested fixes for first-app/14-http Step 3 Sample JSON HOT 1
- ErrorHandler stop working on Angular 18?
- Problem adding firebase HOT 1
- new Lifecycle hook ngOnServer HOT 1
- Support configuration of attachShadow when Custom Elements are created
- Deprecate "waitForAsync" in @angular/core/testing
- Use WebGL for testing in continuous integration HOT 1
- JIT compiler unavailable error with blank screen ( after updated from Angular 15.1.0 -> 16.2.14) HOT 10
- [Bug]: Cannot read properties of undefined (reading 'each') of zone-testing
- ng-content Projection with e-columns Directives Not Working with our own Angular grid component HOT 3
- Allow to pass a custom cookie parser function to create XSRF_COOKIE_NAME
- Moving projected content into another DOM element is not getting destroyed when they should, causes a memory leaks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.