Guest User

Untitled

a guest
Jul 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <script>
  2. sap.ui.getCore().attachInit(function() {
  3. sap.ui.component({
  4. id: "myComponentID",
  5. async: true,
  6. name: "myNamespace", // The namespace you defined in the bootstrap tag and points to the folder where the Component.js file is stored
  7. manifestFirst: true
  8. }).then(function(oNewComponent){
  9. new sap.m.Shell({
  10. app: new sap.ui.core.ComponentContainer({
  11. component: oNewComponent,
  12. height : "100%"
  13. })
  14. }).placeAt("content");
  15. })
  16. });
  17. </script>
  18.  
  19. /**
  20. * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
  21. * @public
  22. * @override
  23. */
  24. init: function() {
  25. //Map Component ID in a Core variable
  26. if(!sap.ui.getCore()._data_oLoadedComponents){
  27. sap.ui.getCore()._data_oLoadedComponents = {};
  28. }
  29. sap.ui.getCore()._data_oLoadedComponents.myCustomComponentId = this.getId(); // myCustomComponentId is the ID you want to use for this specific app
  30. // END: Map Component ID in a Core Variable
  31.  
  32. // call the base component's init function
  33. UIComponent.prototype.init.apply(this, arguments);
  34.  
  35. // set the device model
  36. this.setModel(models.createDeviceModel(), "device");
  37. }
  38.  
  39. sap.ui.getCore().getComponent(sap.ui.getCore()._data_aLoadedComponents.myCustomComponentId)
  40.  
  41. sap.ui.getCore().getComponent(sap.ui.getCore()._data_aLoadedComponents.myCustomComponentId).getModel('modelName')
Add Comment
Please, Sign In to add comment