I have done numerous addins in the past but I have never had this error before.
I have an angular app with a parent component and router outlet to the child component. Irrespective of whether I put this code in the parent or child I get the same error message.
In ngOnInit I have added the very simple code as follows:
public ngOnInit() {
console.log("in ngoniinit");
console.log("in 2");
this._AddinClientService.args.subscribe((args: AddinClientInitArgs) => {
console.log("In login.component addiniclientservice.args.subscribe");
this.environmentId = args.envId;
sessionStorage.setItem("envId", args.envId ?? "")
args.ready({
showUI: true, title: environment.appDisplayName
});
});
My console shows the following:
In app.component ngoninit
in ngoniinit
in 2
ERROR TypeError: Cannot read properties of undefined (reading 'app')
at r.initializeTheme (main-QVCS4SD6.js:234:77006)
at Object.init (main-QVCS4SD6.js:234:75400)
at r.handleMessage (main-QVCS4SD6.js:1:29864)
at windowMessageHandler (main-QVCS4SD6.js:1:26021)
at f.invokeTask (polyfills-FFHMD2TL.js:1:7068)
at Object.onInvokeTask (chunk-NBNEUFUA.js:7:29616)
at f.invokeTask (polyfills-FFHMD2TL.js:1:6989)
at t.runTask (polyfills-FFHMD2TL.js:1:2375)
at E.invokeTask [as invoke] (polyfills-FFHMD2TL.js:1:8144)
at I (polyfills-FFHMD2TL.js:1:15196)
(The first console line comes from the parent ngOnInit method).
It never comes out of my _AddinClientService clause. Is there something that has not been initialised correctly? Do I need to set something else up?
Thanks in advance for any help