Hi

I've attached a copy.  If you want to make a change to the plugin, you will 
need to install node_modules in the plugins folder.

Click on the ribbon button called "First Plugin".  It will add a tab with 
the template from the plugin.  Clicking the Business Icon will also show a 
component that is *not *a plugin.

On ribbon.component.ts, there is an event called save.  A breakpoint here 
will show that the component.instance doesn't have a method called save for 
the plugin but for the business tab it does.  btw, the business tab, you 
need to fill in all details to enable the save button.

Thanks for looking.  I am literally going round in circles.

I'm wondering if the issue is that the plugin is bundled and the methods 
are not exposed properly.  Don't know really.

Thanks


On Tuesday, 12 February 2019 13:40:03 UTC, Sumair Ahmed wrote:
>
> Hi, I have implemented a plugin architecture in Angular 7.  Plugins are 
> compiled using rollup to create a plugin.bundle.js file.
>
> I have a tab structure that shows the tab and the component. I also save 
> the componentfactory for all components(plugins and not). This all works 
> fine.  
>
> Now my problem is that i am trying to access the save event on the plugin 
> component.  When i call my non-plugin component i can see the methods.  
> However, when i call the plugin, i cannot see the methods.  I have no idea 
> why.  Any Ideas?
>
> *My Plugin*
> import { Component, Input } from '@angular/core';
> import { NgForm } from '@angular/forms';
>
> @Component({
> selector: 'firstPlugin-component',
> template: '<h1>My First Plugin</h1>'
> })
> export class FirstPluginComponent {
> public myForm: NgForm;
>
> public save(): void {
> alert("I am trying to save");
> }
> }
>
> My Tab Component
> // We create an injector out of the data we want to pass down and this 
> components injector
> let injector = ReflectiveInjector.fromResolvedProviders(resolvedInputs, 
> vcRef.parentInjector);
>
> if (component != null) {
> let factory = this.resolver.resolveComponentFactory(component);
> comp = factory.create(injector);
> } else {
> var plugin = this._pluginService.getPluginByName(componentName);
> comp = plugin.Component.create(injector);
> }
>
> vcRef.insert(comp.hostView);
> tabsModel.component = comp;
>
> *Button to save*
> case 'save':
> let comp = this.MainTabService.getCurrentSelectedTab();
> comp.component.instance.save(); //save method not available on plugin 
> component
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to