This is the initial page, generated on the backend (the json-configuration will replace 'propval' as a variable):
<%- include('template/head'); %>
<application [userdata]='"propval"'>
Loading...
</application>
<%- include('template/foot'); %>
Here is the component that manages the 'application' selector:
@Component({
moduleId: module.id,
selector: 'application',
templateUrl: './app.component.html',
providers:[
ProgressBar
]
})
export class AppComponent implements OnInit {
public userdata;
constructor(public progressBar :ProgressBar, private router: Router) {
console.log("constructor",this.userdata);
}
public async ngOnInit() {
console.log("ngOnInit",this.userdata);
}
}
When looking at the console, the output shows:
constructor undefined
ngOnInit undefined
How can we access the userdata
property? It seems like this might not be achievable in the AppComponent
, since the application
selector is not rendered within the app.component.html
. The rendering of the application
selector occurs on the backend.