-
Notifications
You must be signed in to change notification settings - Fork 590
Open
Description
Problem description
The latest adaptivecards-templating
and adaptive-expressions
packages seem incompatible. Following the docs for javascript as provided here results in Uncaught TypeError: $ is not a function
. I'm using the packages in Angular.
Manually setting the version of adaptive-expressions
to 4.22.3
resolves the error, but I would like to to use the latest version.
Repro
Code
Please refer to Stackblitz above for full repro.
import { Component, OnInit } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import * as ACData from 'adaptivecards-templating';
import * as AdaptiveCards from 'adaptivecards';
@Component({
selector: 'app-root',
template: `
<h1>Hello from {{ name }}!</h1>
<a target="_blank" href="https://angular.dev/overview">
Learn more about Angular
</a>
<div id="container"></div>
`,
})
export class App implements OnInit {
name = 'Angular';
ngOnInit() {
const templatePayload = {
type: 'AdaptiveCard',
version: '1.0',
body: [
{
type: 'TextBlock',
text: 'Hello ${name}!',
},
],
};
const template = new ACData.Template(templatePayload);
const cardPayload = template.expand({
$root: {
name: 'Example card',
},
});
const adaptiveCard = new AdaptiveCards.AdaptiveCard();
adaptiveCard.parse(cardPayload);
const renderedCard = adaptiveCard.render();
if (renderedCard)
document.getElementById('container')?.appendChild(renderedCard);
}
}
bootstrapApplication(App);
Stacktrace
Uncaught TypeError: $ is not a function
at 668.../internals/export (browser.js:87213:7)
at o (browser.js:35:19)
at browser.js:37:20
at 781.../modules/es.global-this (browser.js:91907:7)
at o (browser.js:35:19)
at browser.js:37:20
at Object.<anonymous> (browser.js:82285:11)
at Object.<anonymous> (browser.js:82301:12)
at 522.@babel/runtime/helpers/interopRequireDefault (browser.js:82302:10)
at o (browser.js:35:19)
JesseDeBruijne and MrCodeWeaver
Metadata
Metadata
Assignees
Labels
No labels