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

Inheriting from a Directive overwrites annotations on child class #2291

Closed
jelbourn opened this issue Jun 2, 2015 · 2 comments
Closed

Inheriting from a Directive overwrites annotations on child class #2291

jelbourn opened this issue Jun 2, 2015 · 2 comments
Assignees
Labels
area: common Issues related to APIs in the @angular/common package effort2: days type: bug/fix
Milestone

Comments

@jelbourn
Copy link
Member

jelbourn commented Jun 2, 2015

Say I have a directive MdCheckbox

@Component({ selector: 'md-checkbox' })
@View({template: '...'})
export class MdCheckbox {
  ...
}

and then create a child class for MdSwitch, as the functionality is identical:

@Component({ selector: 'md-switch' })
@View({template: '...'})
export class MdSwitch extends MdCheckbox { }

If we then have a demo app:

@Component({  selector: 'demo-app' })
@View({
  template: '<md-switch></md-switch>',
  directives: [MdSwitch]
})
class DemoApp { ... }

The <md-switch> element is totally inert / empty. However, if we change it to <md-checkbox> (which is not included in directives), an md-checkbox is rendered out. It seems that the annotations on MdCheckbox are overwriting the annotations on MdSwitch when the latter extends the former.

This used to work before the components were converted to TypeScript, making it even more clear that this has something to do with TS decorators.

FYI @vsavkin @rkirov

@jelbourn jelbourn added type: bug/fix area: common Issues related to APIs in the @angular/common package P2: required labels Jun 2, 2015
@naomiblack naomiblack added this to the alpha-34 milestone Jul 27, 2015
@naomiblack
Copy link
Contributor

Jeremy to start on this, using @tbosch and @vsavkin to pair with as relevant.

@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: common Issues related to APIs in the @angular/common package effort2: days type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants