<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hosting Viya report package in an Angular application in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940467#M18189</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to integrate a reportpackage within my angular application.&lt;/P&gt;&lt;P&gt;With the instructions from this page&amp;nbsp;&lt;A href="https://developer.sas.com/sdk/va/docs/guides/esm" target="_blank"&gt;https://developer.sas.com/sdk/va/docs/guides/esm&lt;/A&gt;&amp;nbsp;I create a page and imported the `&lt;SPAN&gt;@sassoftware/va-report-components&lt;/SPAN&gt;` package. After that I added a report element on an empty page:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pim2_0-1724338009154.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99549iE9C415D042271C16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pim2_0-1724338009154.png" alt="Pim2_0-1724338009154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the report-package is unzipped in the ./report map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get nothing visual on my page, but I do get the following errors in de browser-console:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pim2_1-1724338176112.png" style="width: 621px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99550i5E3E94F13D22AEF6/image-dimensions/621x207?v=v2" width="621" height="207" role="button" title="Pim2_1-1724338176112.png" alt="Pim2_1-1724338176112.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I host the report-package directly in IIS and use the provided index.html the report does work as expacted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;And how should I integrate this report in Angular?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Pim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2024 14:51:55 GMT</pubDate>
    <dc:creator>Pim2</dc:creator>
    <dc:date>2024-08-22T14:51:55Z</dc:date>
    <item>
      <title>Hosting Viya report package in an Angular application</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940467#M18189</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to integrate a reportpackage within my angular application.&lt;/P&gt;&lt;P&gt;With the instructions from this page&amp;nbsp;&lt;A href="https://developer.sas.com/sdk/va/docs/guides/esm" target="_blank"&gt;https://developer.sas.com/sdk/va/docs/guides/esm&lt;/A&gt;&amp;nbsp;I create a page and imported the `&lt;SPAN&gt;@sassoftware/va-report-components&lt;/SPAN&gt;` package. After that I added a report element on an empty page:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pim2_0-1724338009154.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99549iE9C415D042271C16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pim2_0-1724338009154.png" alt="Pim2_0-1724338009154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the report-package is unzipped in the ./report map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get nothing visual on my page, but I do get the following errors in de browser-console:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pim2_1-1724338176112.png" style="width: 621px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99550i5E3E94F13D22AEF6/image-dimensions/621x207?v=v2" width="621" height="207" role="button" title="Pim2_1-1724338176112.png" alt="Pim2_1-1724338176112.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I host the report-package directly in IIS and use the provided index.html the report does work as expacted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;And how should I integrate this report in Angular?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Pim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 14:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940467#M18189</guid>
      <dc:creator>Pim2</dc:creator>
      <dc:date>2024-08-22T14:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting Viya report package in an Angular application</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940811#M18206</link>
      <description>&lt;P&gt;I managed to get to the next step. I had to include this in my header:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pim2_0-1724654217475.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99619i94E8999C179617C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pim2_0-1724654217475.png" alt="Pim2_0-1724654217475.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After that the &amp;lt;sas-report&amp;gt; tag is reconised:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pim2_1-1724654304013.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99620iDC0B31286D9BB953/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pim2_1-1724654304013.png" alt="Pim2_1-1724654304013.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the report is still not loaded. I get different errors:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pim2_2-1724654511204.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99621i3C3D59E4E5BCEF5A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pim2_2-1724654511204.png" alt="Pim2_2-1724654511204.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 06:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940811#M18206</guid>
      <dc:creator>Pim2</dc:creator>
      <dc:date>2024-08-26T06:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting Viya report package in an Angular application</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940936#M18213</link>
      <description>&lt;P&gt;Has been a little while since I last worked on an Angular but here are some tips.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Install the report components modules if not done already in your project. Use the &lt;EM&gt;--save&lt;/EM&gt; option to update your &lt;EM&gt;package.json&lt;/EM&gt;:&lt;BR /&gt;
&lt;PRE&gt;npm install @sassoftware/va-report-components --save&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;Make sure to disable the cache for your project - I remember having difficulties serving .js files from the SDK module otherwise. You can switch off the cache in &lt;EM&gt;angular.json&lt;/EM&gt; via:&lt;BR /&gt;&lt;LI-CODE lang="json"&gt; "cli": {
  "cache": {
    "enabled": false
  }
},​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Best to serve static files via a local &lt;EM&gt;assets&lt;/EM&gt; folder instead of importing modules. This makes referencing the modules in &lt;EM&gt;index.html&lt;/EM&gt; easier. I believe this is related to the lack of configuration options of the underlying vite server. I simply copied all files from&amp;nbsp;&lt;EM&gt;node_modules/@sassoftware/va-report-components/dist&lt;/EM&gt; to the assets folder, e.g.&amp;nbsp; &lt;EM&gt;assets/sdk-assets&lt;/EM&gt;.&lt;/LI&gt;
&lt;LI&gt;Extract your report package content also into the &lt;EM&gt;assets&lt;/EM&gt; folder. For instance create a sub folder &lt;EM&gt;reports&lt;/EM&gt; and have all reports hosted there. The same applies here - we want the report package to be hosted statically.&lt;/LI&gt;
&lt;LI&gt;Register the assets folder as such static source folder in your &lt;EM&gt;angular.json&lt;/EM&gt; file (projects/architect/build/options):&lt;BR /&gt;&lt;LI-CODE lang="json"&gt;"assets": [
  "src/assets"
],​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Add related references to those scripts in your &lt;EM&gt;index.html&lt;/EM&gt; and don't forget to add the &lt;EM&gt;&amp;lt;DIV/&amp;gt;&lt;/EM&gt; container to the body for the SAS report:&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;title&amp;gt;MyAngularProject&amp;lt;/title&amp;gt;
    &amp;lt;base href="/" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1" /&amp;gt;
    &amp;lt;link rel="icon" type="image/x-icon" href="favicon.ico" /&amp;gt;
    &amp;lt;script src="assets/sdk-assets/dist/umd/va-report-components.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;link rel="stylesheet" href="assets/sdk-assets/dist/umd/style.css" /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;app-root&amp;gt;&amp;lt;/app-root&amp;gt;
    &amp;lt;!-- Container for the SAS Report --&amp;gt;
    &amp;lt;div id="sas-report-container"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Define the SDK element via &lt;EM&gt;CUSTOM_ELEMENTS_SCHEMA&lt;/EM&gt; since won't compile otherwise (assuming you are using TypeScript?). An example of defining the &lt;EM&gt;SASReportPageElement&lt;/EM&gt; would be the following:&lt;/LI&gt;
&lt;LI&gt;&lt;LI-CODE lang="javascript"&gt;import { Component, OnInit, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { SASReportPageElement } from '@sassoftware/va-report-components';

@Component({
  selector: 'app-home',
  standalone: true,
  imports: [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  templateUrl: './home.component.html',
  styleUrl: './home.component.css',
})
export class HomeComponent implements OnInit {
  ngOnInit() {
    // Ensure the custom element is defined
    if (!customElements.get('sas-report-page')) {
      customElements.define('sas-report-page', SASReportPageElement);
    }
  }
}​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Once done - you can reference the element in your template .html as normal. Adjust the &lt;EM&gt;packageUri&lt;/EM&gt; to point to your report package in the &lt;EM&gt;assets&lt;/EM&gt; folder:&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;p&amp;gt;home works!&amp;lt;/p&amp;gt;
&amp;lt;sas-report-page
  packageUri="../../assets/reports/MyReportPackage"
  pageName="vi92"
  style="width: 600px; height: 300px"
&amp;gt;&amp;lt;/sas-report-page&amp;gt;​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I'm also seeing some translation error I18N messages in the console in my quick test program here - but this doesn't seem to cause any harm. Assuming some of the non-EN resource packages aren't available. This may need more tweaks for the underlying webpack config.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you see a console message "&lt;EM&gt; ../reportPackage.xml 404 not found&lt;/EM&gt;" - verify the &lt;EM&gt;packageUri&lt;/EM&gt; attribute and make sure that is referencing the correct location of your report package.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps. Falko&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 00:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940936#M18213</guid>
      <dc:creator>FalkoSchulz</dc:creator>
      <dc:date>2024-08-27T00:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting Viya report package in an Angular application</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940983#M18215</link>
      <description>I think I missed the cache-setting. I got it to work on my local machine now. Thanks!</description>
      <pubDate>Tue, 27 Aug 2024 07:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Hosting-Viya-report-package-in-an-Angular-application/m-p/940983#M18215</guid>
      <dc:creator>Pim2</dc:creator>
      <dc:date>2024-08-27T07:30:13Z</dc:date>
    </item>
  </channel>
</rss>

