Oracle-jet with typescript web component

Viewed 794

I have created application with typescript run:

ojet create web-app-navbar --template=navbar --typescript

then I have creatd web component run:

ojet create components demo-card --typescript

ojet cli has created demo-card component successfully. I want to add demo-card component to about page and I have add html tag:

// IT IS about.ts
class AboutViewModel {

  constructor() {

  }

  /**
   * Optional ViewModel method invoked after the View is inserted into the
   * document DOM.  The application can put logic that requires the DOM being
   * attached here. 
   * This method might be called multiple times - after the View is created
   * and inserted into the DOM and after the View is reconnected
   * after being disconnected.
   */
  connected(): void {
    // implement if needed
  }

  /**
   * Optional ViewModel method invoked after the View is disconnected from the DOM.
   */
  disconnected(): void {
    // implement if needed
  }

  /**
   * Optional ViewModel method invoked after transition to the new View is complete.
   * That includes any possible animation between the old and the new View.
   */
  transitionCompleted(): void {
    // implement if needed
  }
}

export default AboutViewModel;
<!--
 Copyright (c) 2014, 2020, Oracle and/or its affiliates.
 The Universal Permissive License (UPL), Version 1.0
 -->
 <!-- IT IS about.html view -->
<div class="oj-hybrid-padding">
  <h1>About Content Area</h1>
  <div>
      To change the content of this section, you will make edits to the about.html file located in the /js/views folder.
  </div>
  <deno-card></deno-card>
</div>

but it don't displayed on the page. How can I add this component to my application?

1 Answers

Add import 'demo-card/loader' to about.ts

When using the ojet cli a path to the component is automatically set up for you. You need to add import 'demo-card/loader' to automatically resolve the correct path for the transpiled component.

Related