- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2020 12:50 PM
I'm working on our home page and we're showing articles to logged in users, but not to logged out users. This makes the homepage pretty empty to people who aren't logged in.
I've been working on a widget that will just show some marketing text, but I can't get the angular JS to work.
Any advice on how I can hide or show a widget depending on a person's logged in status?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2020 01:01 PM
Basically use ng-if.
In the below example the data will only show when the myVar is true(If the user is logged in)
If you only want to show it to non logged in, reverse the condtion
<div ng-if="!myVar">
HTML
<div ng-if="myVar">
<h1>Welcome</h1>
<p>Welcome to my home.</p>
<hr>
</div>
Server Side
data.myVar = gs.isLoggedIn();
Regards
Pranav

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2020 01:01 PM
Basically use ng-if.
In the below example the data will only show when the myVar is true(If the user is logged in)
If you only want to show it to non logged in, reverse the condtion
<div ng-if="!myVar">
HTML
<div ng-if="myVar">
<h1>Welcome</h1>
<p>Welcome to my home.</p>
<hr>
</div>
Server Side
data.myVar = gs.isLoggedIn();
Regards
Pranav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 06:56 AM
Thanks for the help Pranav, this did it!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2021 05:05 AM