Umbraco 17 Eqivalent to $scope.block.data

Hi,

I am looking in to Upgrading Agular controllers we have created. I just can’t find the equivalent of $scope.block.data.

Can any one advise how I convert this code:

angular.module(“umbraco”).controller(“richTextBlockController”, function ($scope, $sce) {
$scope.trustedContent = $sce.trustAsHtml($scope.block.data.richTextEditor.markup);
});

Thanks

Darren

Hey @darrenhunterEmerald,

What if you will use below code snippet?

import { html } from "@umbraco-cms/backoffice/external/lit";
import { UmbLitElement } from "@umbraco-cms/backoffice/lit-element";

class RichTextBlockElement extends UmbLitElement {
  static properties = {
    value: { type: Object }
  };

  render() {
    return html`
      <div .innerHTML=${this.value?.markup ?? ""}></div>
    `;
  }
}

customElements.define(
  "rich-text-block-element",
  RichTextBlockElement
);

thank you for your help.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.