I believe this is for angular 1 not angular 2 which wouldn't help in his case. Have you look at using the DynamicComponentLoader? This should allow you to insert the component into the html at a position and keep a reference to it outside, this is the only current way I have found of accessing a component that you are injecting.
On Sunday, January 3, 2016 at 11:11:46 PM UTC-8, Ankush Joshi wrote: > > Hey, > > This might help you > > > *http://archugs.blogspot.in/2014/12/angularjs-ngDialog.html > <http://archugs.blogspot.in/2014/12/angularjs-ngDialog.html>* > > > > > On Monday, September 21, 2015 at 11:20:27 PM UTC+5:30, Vern Jensen wrote: >> >> I'm looking to implement custom dialogs in Angular 2, similar to what is >> built into Angular 1, so I can port code there. >> >> I found a project online that does this using Angular 2 Alpha 26, but >> attempting to get it to work in my environment was a nightmare so I have >> abandoned that in favor of jQuery UI dialogs which are very easy and >> provide all the functionality I need. >> >> I'm just trying to figure out how to wrap this inside of an Angular 2 >> directive/class. Each dialog has its own custom HTML in the body, so I >> figure wrapping this in an Angular 2 directive would be the way to go. Then >> in the HTML I put: >> >> <mydialog myprop="foo"></mydialog> >> >> and then when I'm ready to use that from the code, I could call: >> >> var dialogA = new MyDialog(); >> dialogA.show(); >> >> Problem is, <mydialog> in the HTML instantiates a *separate* instance of >> mydialog than "new MyDialog()" does in the code when I want to actually >> show it from some other place in the code. And, the dialog created via "new >> MyDialog()" doesn't have access to any of the custom properties set on >> <mydialog> such as myprop="foo". >> >> How do I access the instance of "mydialog" that was already created in >> html via the <mydialog> directive, and call a method in its class? >> >> -Vern >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" 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.
