IronRouter extending data option on route controller

前端 未结 4 1642
清酒与你
清酒与你 2021-02-20 13:16

Is there a way to extend the data option when using IronRouter and the RouteController, It seems like it gets overridden when I inherit from a super co

4条回答
  •  佛祖请我去吃肉
    2021-02-20 13:23

    I think _.extends should work in this case as well:

    ChildController = ApplicationController.extend({
      data: function() {
        var base = ApplicationController.data.call(this);
        return _.extends(base, {
          someData: {},
        });
      }
    });
    

提交回复
热议问题