How to expose angular 2 methods publicly?

前端 未结 5 1370
再見小時候
再見小時候 2020-11-28 09:40

I am currently working on porting a Backbone project to an Angular 2 project (obviously with a lot of changes), and one of the project requirements requires certain methods

5条回答
  •  遥遥无期
    2020-11-28 10:02

    I was checking the code, and I have faced that the Zone is not probably necessary. It works well without the NgZone.

    In component constructor do this:

    constructor(....) {
       window['fncIdentifierCompRef'] = {
          component  = this
       };
    }
    

    And in the root script try this:

    
    

    This works to me.

提交回复
热议问题