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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.