Hi ,
i am developing an App in angular 6, i have a layout Component and
different components which will be inside layout (side-nav thing).
I am getting the property value using the ComponentRef , but if i change
the childComonents property using service i am not able to get the latest
value.
This is my code .
layout.html
<router-outlet (activate)="onActivate($event)" ></router-outlet>
layout.ts
onActivate(componentRef){
console.log(componentRef)
if(componentRef.L2 !=='undefined'){
this.L2 = componentRef.L2
console.log(this.L2)
}
}
Cmatterscomponent.ts
export class CmattersComponent implements OnInit {
title= 'sometitle'
L2 //getting the value via service in the constructor
}
i am able to get the title in the layout which is statically mentioned in
childcomponent ,
but get L2 as undefined(do i need to wait until the data is fetched from
service),is this the best approach to get the data.
please help,
thanks,
Rohit.
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.