triniwiz / nativescript-popup

Apache License 2.0
22 stars 17 forks source link

Using template path as source. #7

Open BeMor81 opened 6 years ago

BeMor81 commented 6 years ago

Tested only on Android emulator, tns version 3.4.1. Getting the following error when passing a template path as source.

JS: ERROR Error: Uncaught (in promise): Error: Expecting a valid View instance. JS: Error: Expecting a valid View instance. JS: at StackLayout.ViewBase._addView (file:///data/data/com.m.myapp/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:337:19) [angular]

Skintillion commented 6 years ago

popup.showPopup(args.object,'~/components/thread/context.xml');

This works on android for me.

dottodot commented 5 years ago

I think the problem is that this doesn't work with Angular. When using this from the demo

  showTemplatePopup(args) {
    this._showPopup(this.page.getViewById('btn'), '~/template/bomb.html');
  }

I get Error: Expecting a valid View instance.

and when I try

  showPopupList() {
    const listPath = fs.path.join(
      fs.knownFolders.currentApp().path,
      '/template/list.html'
    );
    const component = builder.load(listPath);
    component.bindingContext = this;
    this._showPopup(this.page.getViewById('btnList'), component);
  }

the component is undefined but I believe that is because ui/builder is intended for NativeScript core applications and not Angular.

stevenspiel commented 5 years ago

I am also getting undefined, but I'm using a nativescript core app