Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature offer: some annotation inside templates to indicate the interface they require. #6317

Closed
matantsu opened this issue Jan 7, 2016 · 2 comments
Labels
area: core Issues related to the framework runtime feature Issue that requests a new feature

Comments

@matantsu
Copy link

matantsu commented Jan 7, 2016

I think it will make templates much more self-contained if there was an annotation declaring what interface the template requires from it's component and have an alias for this component inside of the template.

Example:

<template-declaration>
//define an interface this template requires.
interface IMyTemplate{
   shoes: Shoe[],
   currentUser: User
}
//get a reference to the component (must implement interface , otherwise compilation error)
myComponentAlias: IMyTemplate = component;
</template-declaration>
<div>
    {{myComponentAlias.currentUser.name}}  // fine
    {{myComponentAlias.unknownProperty}}  // compilation error
</div>

This would make a clear separation between layout&design vs view-logic. The designer would no longer need to refer to code and the coder would no longer need to refer to html to do their work.

I could swap different components for the same view , as long as they implement the required interface.

Now, I understand this is quite a demand and that it requires alot of work, templates now require compilation, have typescript inside of them etc...
But you wisards at angular are capable enough. Im sure @mhevery would like this feature.

@pkozlowski-opensource pkozlowski-opensource added feature Issue that requests a new feature area: core Issues related to the framework runtime labels Oct 4, 2016
@vicb
Copy link
Contributor

vicb commented Oct 7, 2016

{{myComponentAlias.unknownProperty}} should fail in AoT (well myComponentAlias is not supported, you can add a getter for that)

@vicb vicb closed this as completed Oct 7, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

3 participants