1

In new angular components, $scope cannot be injected so I can't use the standard $emit.

How to I emit a value from a component to parent controller?

I have this in appCtrl:

 $scope.$on('eventName', function (event, args) {
   this.pageTitle = args.pageTitle;
  }.bind(this));

Usually I have done it using:

this.scope.$emit('eventName', { pageTitle: _this.campaign.title });
Alexandru R
  • 8,560
  • 16
  • 64
  • 98

1 Answers1

0

I have a similar issue. I need to do a $scope.apply() in a component.

Check this issue here How can we watch expressions inside a controller in angular 1.4 using angular-new-router

I am not sure if using / injecting $scope into a component is the way to go because of the migraiton path to Angular 2. Maybe there is a better way using zone.js https://github.com/angular/zone.js/

Community
  • 1
  • 1