Skip to content

Component *change events consistency #7191

Open
@rafaelss95

Description

@rafaelss95

Bug, feature request, or proposal:

Proposal.

What is the expected behavior?

I'd expect all components to have the same behavior. Or all return a plain object, or all return an instance of a class.

What is the current behavior?

Some components return a plain object, others return an instance of a class.

What components have a different behavior?

Topic 1 (About emit a plain object):

Chip: https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/chips/chip.ts#L183

Paginator: https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/paginator/paginator.ts#L189

Sort: https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/sort/sort.ts#L131


Topic 2 (Some "change" events are named ...Event, some others are ...Change and others are ...ChangeEvent):
https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/autocomplete/autocomplete.ts#L35
Suffixed by 'Event'.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/tabs/tab-group.ts#L43
This is the only event that is suffixed by 'Change' and 'Event'.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/chips/chip.ts#L25
Besides being an interface (not a class), it isn't suffixed by 'Change'.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/chips/chip-input.ts#L16
Not sure about this. I think this can't be considered inconsistency, but I'll left it here anyway.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/paginator/paginator.ts#L30
Suffixed by 'Event'.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/sort/sort.ts#L41
Besides being an interface (not a class), it isn't suffixed by 'Change'.

Is there anything else we should know?

Maybe it's a complement of #6677.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: manyArea label for issues related to many componentsrefactoringThis issue is related to a refactoringtarget: majorThis PR is targeted for the next major release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions