Created
August 6, 2022 14:13
-
-
Save aniketmuruskar/7e50ac641313afb873f529496db44671 to your computer and use it in GitHub Desktop.
App dynamic component to listen route resolve data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { ActivatedRoute } from '@angular/router'; | |
import { AddComponent } from '../add.component'; | |
@Component({ | |
selector: 'app-dynamic-component', | |
templateUrl: './app-dynamic.component.html', | |
styleUrls: [] | |
}) | |
export class AppDynamicComponent implements OnInit { | |
components: AddComponent[] = []; | |
constructor( | |
private route: ActivatedRoute | |
) {} | |
ngOnInit(): void { | |
this.route.data.subscribe(data => { | |
this.components = data['page']; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment