I'm trying to replace the location strategy by condition prod/dev
console.log(IonicENV.mode) <= this loges true
Then
{ provide: LocationStrategy, useClass: (IonicENV.mode == "prod") ? PathLocationStrateg HashLocationStrategy }
Although IonicEnv.mode returns prod, so the condition is true. but it always goes into using HashlocationStrategy. There is no logical explanation at all…
if I do
{ provide: LocationStrategy, useClass: (console.log(IonicENV.mode == "prod")) ? PathLocationStrategy : HashLocationStrategy }
Then everything works correctly on the server. it meets the true condition and goes into using pathLocationStrategy… Any explanations…anyone??
console.log()
always return undefined
and !!undefined
is false
. So
(console.log(IonicENV.mode == "prod")) ? PathLocationStrategy : HashLocationStratege
is the same as
(false) ? PathLocationStrategy : HashLocationStratege // because of braces
and is the same as HashLocationStratege
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.