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

Events not fired from broadcasting #11

Open
@mitjarogl

Description

@mitjarogl

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;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions