Reputation: 12015
According this component code:
@Component({
selector: "app-create-plan",
templateUrl: "./create.html",
styleUrls: ["../calendar-thematic-plan-create.component.css"]
})
export class CreatePlanComponent extends CalendarThematicPlanCreateComponent
implements OnDestroy {
public rows: any[] =[];
constructor() {}
Does Angular destroy component's properties like public rows: any[] =[];
after leaving component? Or I must do this himself in ngOnDestroy?
ngOnDestroy(): void {
this.rows = [];
}
Upvotes: 1
Views: 2369
Reputation: 2885
It depends, if the component is really destroyed, all the property are destroyed within it. Be aware, if you are using routing, something like:
{path: ':id', component: someRandomComponent }
Angular will reuse the component if only the id in the url change, in that case, you have to pay attention to the properties in the component because they are not reinitialized.
Upvotes: 2