Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Faceless component not calling init()

I have a UIComponent which has a dependency of a faceless Component.

Main component metadata:

    jQuery.sap.declare("MYAPP.Component");

   

    sap.ui.core.UIComponent.extend("MYAPP.Component", {

      metadata: {

        dependencies: {

          libs: [],

          components: [

            "MYAPP.Component2"

          ]

        }, etc

The app indicates it has reached the faceless component, since if I make some deliberate syntax errors I do get the error messages when loading the webpage. I can also get a console.log("test") to print out from outside the sap.ui.core.Component.extend() code.

    jQuery.sap.declare("Component2.Component");

   

    console.log("outside test"); //this prints

   

    sap.ui.core.Component.extend("Component2.Component", {

      metadata: {

      },

   

      init: function(){

        sap.ui.core.Component.prototype.init.apply(this, arguments);

        console.log("component2 init test"); //this doesn't print

      }

   

    });

My folder structure:

    MYAPP

      /Component2               //faceless component folder

        Component.js

      /view                     //views and controllers folder

      Component.js              //main component

      index.html

Tags:
Former Member
replied

sap.ui.component( {name: "MYAPP.Component2" } )

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question