salix/front/salix/bootstrap.js

18 lines
502 B
JavaScript

import {ng} from 'core/vendor';
import appName from './module';
export const bootstrap = () => {
const selector = 'selector';
let _script = document.currentScript || (() => {
let scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();
let _element = _script && document.querySelector(_script.getAttribute(selector));
if (!_element)
throw new Error('Element is not defined');
ng.bootstrap(_element, [appName]);
};