Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_createPageLoader() {
const componentRefMap:WeakMap> = new WeakMap>();
return new ons.PageLoader(
({page, parent, params}: any, done: Function) => {
const injector = Injector.create({
providers: [
{provide: Params, useValue: new Params(params || {})},
{provide: OnsSplitterContent, useValue: this}
],
parent: this._injector
});
const factory = this._resolver.resolveComponentFactory(page);
const pageComponentRef = this._viewContainer.createComponent(factory, 0, injector);
const pageElement = pageComponentRef.location.nativeElement;
componentRefMap.set(pageElement, pageComponentRef);
this.element.appendChild(pageElement); // dirty fix to insert in correct position
_createPageLoader() {
const componentRefMap:WeakMap> = new WeakMap>();
return new ons.PageLoader(
({page, parent, params}: any, done: Function) => {
this._zone.run(() => {
const injector = Injector.create({
providers: [
{provide: Params, useValue: new Params(params || {})},
{provide: OnsSplitterSide, useValue: this}
],
parent: this._injector
});
const factory = this._resolver.resolveComponentFactory(page);
const pageComponentRef = this._viewContainer.createComponent(factory, 0, injector);
const pageElement = pageComponentRef.location.nativeElement;
componentRefMap.set(pageElement, pageComponentRef);
this.element.appendChild(pageElement); // dirty fix to insert in correct position
_createPageLoader() {
const componentRefMap: WeakMap> = new WeakMap>();
return new ons.PageLoader(
({page, parent, params}: any, done: Function) => {
this._zone.run(() => {
const pageParams = new Params(params || {});
const injector = Injector.create({
providers: [
{provide: Params, useValue: pageParams},
{provide: OnsNavigator, useValue: this}
],
parent: this._injector
});
const factory = this._resolver.resolveComponentFactory(page);
const selector = 'ons-navigator';
const pageComponentRef = factory.create(injector, undefined);
this._viewContainer.insert(pageComponentRef.hostView);
const pageElement = pageComponentRef.location.nativeElement;
mounted() {
this.$el.page = this.page || this.$el.page;
this.$el.pageLoader = new PageLoader(
({page, parent, params = {}}, done) => {
if (!page) {
throw new Error(`PageLoader: Expected a VOnsPage Component but got "${page}" for "${parent.tagName.toLowerCase()}"`);
}
if (page.hasOwnProperty('_isVue')) {
page.$parent = page.$parent || _getParentVM(parent);
} else {
page = new Vue({
parent: _getParentVM(parent),
...page,
mixins: [...(page.mixins || []), _inheritProps],
computed: { ...(page.computed || {}), data: () => params }
});
}