I use window.location
to setup for injectable.
In my module near imports I define variable
const flag = window.location.search.includes('flag');
...
{ provide: FLAG, useValue: flag },
and it works as expected with JIT compilation
But when I switch to AoT it breaks
useFactory
works in both cases
export function flagFactory() {
return window.location.search.includes('flag');;
}
...
{ provide: FLAG, useFactory: flagFactory },
Why do I get undefined
with useValue
and true
with useFactory
?