Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Adobe Target SDK on Angular Components

vrao1
Level 1
Level 1

Hi,

I am doing a POC on implementing Adobe Target SDK in Angular application.

My main goal is to show different components based on the Activity configured. 

Example: if the user qualifies for Experience A then show Angular component A else Angular component B.

While I am following the docs but I am still not able to pass the response (activity.id or experience.name or Feature flags response from the content) received from Target SDK to the Angular components.

Is there any way I can achieve this?

 

Below is the code I am using. How can I pass the value of featureFlags.flag to component?

 

const TargetClient = require("@adobe/target-nodejs-sdk");
const options = {
    client: "",
    organizationId: "",
    logger: console,
    decisioningMethod: "on-device",
  events: {
    clientReady: targetClientReady
  }
};
const targetClient = TargetClient.create(options);
function targetClientReady() {
targetClient.getAttributes(["test-feature"]).then(function(response) {
const featureFlags = response.asObject("test-feature");
this.ABFeatureflag=featureFlags.flag;
console.log(this.ABFeatureflag);
if(featureFlags.enabled && featureFlags.flag == "expA") { 

console.log("Render alternate EXP A experience" + featureFlags.flag);
}
if(featureFlags.enabled && featureFlags.flag == "expB") { 
    
console.log("Render alternate EXP B experience" + featureFlags.flag);

});
}
1 Accepted Solution
shelly-goel
Correct answer by
Community Advisor
Community Advisor

@vrao1 

Did you try with const flag = attributes.getValue("homepage", "feature-flag"); ? as mentioned here: https://adobetarget-sdks.gitbook.io/docs/on-device-decisioning/execute-ab-tests-with-feature-flags

(assuming ''test-feature" is your mbox/location)

 

View solution in original post

1 Reply
shelly-goel
Correct answer by
Community Advisor
Community Advisor

@vrao1 

Did you try with const flag = attributes.getValue("homepage", "feature-flag"); ? as mentioned here: https://adobetarget-sdks.gitbook.io/docs/on-device-decisioning/execute-ab-tests-with-feature-flags

(assuming ''test-feature" is your mbox/location)

 

View solution in original post