How to use the onsenui.PageLoader function in onsenui

To help you get started, we’ve selected a few onsenui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OnsenUI / OnsenUI / bindings / angular2 / src / directives / ons-splitter.ts View on Github external
_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
github OnsenUI / OnsenUI / bindings / angular2 / src / directives / ons-splitter.ts View on Github external
_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
github OnsenUI / OnsenUI / bindings / angular2 / src / directives / ons-navigator.ts View on Github external
_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;
github OnsenUI / OnsenUI / bindings / vue / src / mixins / pageLoader.js View on Github external
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 }
          });
        }