loadAndInitAngularIfEnabled.ts 566 B

12345678910111213141516171819202122
  1. import { config, setAngularLoader } from '@grafana/runtime';
  2. export async function loadAndInitAngularIfEnabled() {
  3. if (config.angularSupportEnabled) {
  4. const { AngularApp } = await import(/* webpackChunkName: "AngularApp" */ './index');
  5. const app = new AngularApp();
  6. app.init();
  7. app.bootstrap();
  8. } else {
  9. setAngularLoader({
  10. load: (elem, scopeProps, template) => {
  11. return {
  12. destroy: () => {},
  13. digest: () => {},
  14. getScope: () => {
  15. return {};
  16. },
  17. };
  18. },
  19. });
  20. }
  21. }