Components: Expansion panel closes on data refresh

Created on 16 Nov 2017  路  4Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Expansion panel should not close on data changes

What is the current behavior?

Expansion panel is closing after data is updated

What are the steps to reproduce?

http://plnkr.co/edit/KMgrqrb1gsOHK0AofCOf?p=preview

What is the use-case or motivation for changing an existing behavior?

Users shouldn't re-open the expansion panel when data is updating (e.g http request)

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.0.0
material 5.0.0
typescript 2.4.2
all browsers

Most helpful comment

Closing as this is working as expected.

The expansion panel is not being closed but rather an entirely new expansion panel is being rendered and the old one is destroyed as the object is modified. As @willshowell noted, you can use trackBy to perform the function you are looking for.

All 4 comments

This is expected behavior and due to you assigning a new array to packs. I would suggest looking into trackBy.

http://plnkr.co/edit/OA7SaaVBmeimsOHLDk60?p=preview

Closing as this is working as expected.

The expansion panel is not being closed but rather an entirely new expansion panel is being rendered and the old one is destroyed as the object is modified. As @willshowell noted, you can use trackBy to perform the function you are looking for.

Write this following code you may solve this issue
ngOnInit() {
this.href = this.router.url;
console.log(this.href);
}

[expanded]="[this.href === 'routelink']"

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._

Was this page helpful?
0 / 5 - 0 ratings