Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Events not fired from broadcasting #11

Open
mitjarogl opened this issue Dec 10, 2015 · 0 comments
Open

Events not fired from broadcasting #11

mitjarogl opened this issue Dec 10, 2015 · 0 comments

Comments

@mitjarogl
Copy link

When I try to broadcast event from asyncData I receive no event to child component.

// Parent with async data plugin
asyncData: function () {
    var self = this;
    return this.$http.get('foo.json')
        .then(function (response) {
            self.$broadcast('dataRetrieved', response.data);
            self.data = response.data;
        })
 }

But when I was using broadcast without asyncData I get events to child component

  // Parent without plugin
  methods: {
    getData: function () {

        this.$http.get('foo.json').success(function (data) {
            this.$broadcast('dataRetrieved', data);
            this.data = data;
        }).error(function (err) {
            console.log(err);
        });
    },
 }

Here is my child component, listening for events.

// Child
events: {
    dataRetrieved: function (data) {
       // Here should I get data, but this event is not fired.
        this.data = data;
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant