Asponte Labs > Blog Detail

Web Content Viewer- Asponte Custom Skin

Actions

WCM Quick Hits: Accessing ibmPortalConfig from Angular

  • Created By: Chris Knight
  • Updated: January 24, 2017
  • Tags: developer, wcm, quickhits

Introduction

While developing a single page Angular application that we were using within the WCM Script Portlet (Script Application in newer CF levels), we needed to get the currently logged in user name.  Rather than writing new code to be able to do so, we wanted to leverage the ibmPortalConfig javascript application that the portal theme sets up.

Problem

When we tried to leverage the ibmPortalConfig object within the angular code, it was not available.  The reason was that it wasn't scoped in a way that the angular code was able to retrieve the variable.

Solution

Using the Angular $window:

https://docs.angularjs.org/api/ng/service/$window

 

We were able to gain access to the ibmPortalConfig object:

var portalConfig = $window.ibmPortalConfig;

Complementary Content
${loading}