Thursday, September 28, 2017

Unable to Invoke Angular4’s method from AngularJs?

I am trying to invoke Angualr4’s method by publish event from AngularJs.
I am getting event inside Angular4’s method but not any things live inside
angular4 component everything is undefined, So Unable to perform any activity
in component.

1- public event as:-
         hub.publish('com.xxx.events.xx', id);// from AngularJs file

2- Suscibed here :
         this.hub.subscribe('com.xxx.events.xx', this.onClickCallBack);

    onClickCreateCallBack = function (topic, data) {
            console.log("Type:: "+this);//this object is undefined
            this.openPopup();//Since this is undefined not ivoking openPopup()
      } 

Observations:-

I am booting my Angular4 application by Api call which return all bundles(main bundle, pollyfilles buldle etc..) in form of html response
and I load that response in a div tag.

So here I saw that my Angular4 boot 2 times first when whole environment(AngularJs + other stuffs) boots.

And Second time when I click a Tab Button, here Angular 4 App should be render actually. Here Application launch successfully, but it loss all instance variable ‘s values (becomes undefined).

Note :- Any help would be appreciated.

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/09/28/unable-to-invoke-angular4s-method-from-angularjs/
via @lzomedia #developer #freelance #web

No comments:

Post a Comment