Skip to content

feat: alllow specifying directives as bindings#1498

Closed
pkozlowski-opensource wants to merge 1 commit into
angular:masterfrom
pkozlowski-opensource:issue709
Closed

feat: alllow specifying directives as bindings#1498
pkozlowski-opensource wants to merge 1 commit into
angular:masterfrom
pkozlowski-opensource:issue709

Conversation

@pkozlowski-opensource
Copy link
Copy Markdown
Member

Closes #709

@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

@tbosch would you mind reviewing this one for me?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a tests where you create a binding such as: bind(PublicAPI).toClass(PrivateImpl) and then have a directive which injects

class SomeDecorator {
  constructor(@Parent() api:PublicAP) { 
    expect(api instanceof PrivateImpl).toBe(true);
  }
}
<div public-api>
  <div child-decorator></div>
</div>

@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

@mhevery I've added a test you've been mentioning but while doing so I've realized that this is probably not representing the use-case described by @ajoslin . There are 2 differences I can see:

  • here we are using meta-data (selectors etc.) from the "PublicAPI" while I think @ajoslin was expecting that a selector would be taken from the impl itself
  • the essence of the trick we are playing here that we map a concrete impl (in terms of meta-data) to one concrete implementation. This is a trick that we can play only once per template which probably is not enough for the more advanced use-cases

@ajoslin could you please verify if this commit fixes your use-case or not?

@tbosch
Copy link
Copy Markdown
Contributor

tbosch commented Apr 24, 2015

@pkozlowski-opensource Can we merge this anyways? I need it for another issue...

@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

@tbosch merging this won't break anything so in this sense I think we can. But I still believe that this doesn't address the original issue and might be confusing (we read meta-data from one class and use a different class as impl, even if impl has different meta-data).

I would say that we can merge this if we don't mind reviewing the original issue / introducing breaking changes in the near future.

@tbosch
Copy link
Copy Markdown
Contributor

tbosch commented Apr 24, 2015

Ok, merged, but leaving the original issue open so that we don't forget...

@angular-automatic-lock-bot
Copy link
Copy Markdown

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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@Template.directives can take Bindings (not just types)

5 participants