How to write javascript conditional operator statement ‘?’ without using else ‘:’ [duplicate]


So I’m using typescript in Angular and I have this code in ngOnInit() :

this.authService.isAuthenticate() ?

but I’m getting this error: [ ‘:’ expected.ts(1005) ].

I wanna use the new way to make if else statement (with ‘?’ operator).
so maybe someone knows how to make it without else ‘:’ statement.

Thank you.

Source: Angular Questions

Categorized as angular, ecmascript-6, javascript, typescript Tagged , , ,


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us