
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2018 01:30 AM
Hello All,
I'm creating a widget for my homepage where I'd like to say the users first name in the middle of the screen. For example " <firstname>, welcome to the Hub ".
Widget Code:
HTML:
<div id="homepage-search" class="hidden-xs wrapper-md">
<div class="wrapper-md">
<h1 class="text-center font-thin text-4x m-b-lg sp-tagline-color" ng-bind="options.title"></h1>
<h4 ng-if="options.short_description" class="text-center m-b-lg sp-tagline-color" ng-bind="options.short_description"></h4>
</div>
</div>
CSS:
.sp-tagline-color {
color: $sp-tagline-color;
}
Cilent:
function() { /* widget controller */ var c = this;}
Any idea I'd go about doing this?
All help appreciated.
Thanks,
Jordan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2018 06:24 PM
You should be able to get the user's first name from the scope, so write your client controller like this:
function($scope) {
var c = this;
c.welcome = $scope.user.first_name + " Welcome to the hub";
}
I am not sure where you wanted to put it in your html template, but you can reference it in there as {{c.welcome}}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2018 06:24 PM
You should be able to get the user's first name from the scope, so write your client controller like this:
function($scope) {
var c = this;
c.welcome = $scope.user.first_name + " Welcome to the hub";
}
I am not sure where you wanted to put it in your html template, but you can reference it in there as {{c.welcome}}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2018 01:02 AM
Hi,
Thanks for the help.
But kinda stuck on how I place this in the HTML Template.
I tried: ng-bind="{{c.welcome}}" but didnt seem to work.
Any help appreciated.
Thanks,
Jordan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2018 01:03 AM
I'd like to have this function as the title of the homepage search widget.
Thanks,
Jordan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2018 06:35 AM
if you use ng-bind, don't put the brackets.
Either <div ng-bind="c.welcome"></div>
or <div>{{c.welcome}}</div>
Also, just noticed I left a " out of my original code line. added it now in the original reply.
if you want to troubleshoot it, right-click the search widget and click inspect. From there look up the next element parent that is a widget. those usually have a class="v[some sys_id]". Select that element. then in your javascript console, type angular.element($0).scope().
this will show you the scope of the element you selected. In this case, make sure there is a "user" object on that scope and a c object that contains the welcome message.