mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
fix 'change detection crash' when using router multiple times (#1550)
This commit is contained in:
committed by
Mario Romano
parent
ab73cc66ee
commit
63a7585922
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, Optional, ViewChild } from '@angular/core';
|
import { Component, OnInit, Optional, ViewChild, ChangeDetectorRef } from '@angular/core';
|
||||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||||
import { AlfrescoAuthenticationService, LogService } from 'ng2-alfresco-core';
|
import { AlfrescoAuthenticationService, LogService } from 'ng2-alfresco-core';
|
||||||
import { DocumentActionsService, DocumentListComponent, ContentActionHandler, DocumentActionModel, FolderActionModel } from 'ng2-alfresco-documentlist';
|
import { DocumentActionsService, DocumentListComponent, ContentActionHandler, DocumentActionModel, FolderActionModel } from 'ng2-alfresco-documentlist';
|
||||||
@@ -46,6 +46,7 @@ export class FilesComponent implements OnInit {
|
|||||||
private authService: AlfrescoAuthenticationService,
|
private authService: AlfrescoAuthenticationService,
|
||||||
private formService: FormService,
|
private formService: FormService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
|
private changeDetector: ChangeDetectorRef,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@Optional() private route: ActivatedRoute) {
|
@Optional() private route: ActivatedRoute) {
|
||||||
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
||||||
@@ -98,6 +99,7 @@ export class FilesComponent implements OnInit {
|
|||||||
this.route.params.forEach((params: Params) => {
|
this.route.params.forEach((params: Params) => {
|
||||||
if (params['id']) {
|
if (params['id']) {
|
||||||
this.currentFolderId = params['id'];
|
this.currentFolderId = params['id'];
|
||||||
|
this.changeDetector.detectChanges();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user