Public Method Items API

addItems()

Adds new Items to the current Activity.

You would want to use this method to add extra Items to the current session to give the learner bonus Questions, for example.

Examples

// This example will replace all Items with the two listed in the array
itemsApp.addItems(
    {
        "items": [
            "my_item_reference_1",
            "my_item_reference_2"
        ]
    }
);

// This example will append two Items to the Activity
itemsApp.addItems(
    {
        "items": [
            "my_item_reference_1",
            "my_item_reference_2"
        ],
        "removePreviousItems": false
    }
);

Arguments

  • options object
    • items array[string|object]

      An array of Item references (or Item objects). Each array element specifies one single Item to be added to the assessment.

      When using string references, each Item reference in the array will be fetched and added to the assessment.

      When using objects, each Item object in the array provides the content that will be added to the assessment.

    • removePreviousItems boolean

      When set to true, this will remove all Items in the assessment session before adding the new ones.

      When set to false, the Items will be appended to the assessment session.

      Default: true

Return value

None (undefined).

Related articles

Was this article helpful?