异常:TypeError:'caller'和'arguments'是受限制的函数属性,在此上下文中无法访问

时间:2016-12-21 16:25:13

标签: angularjs kendo-ui ecmascript-6

我使用Kendo UI,Angular和ES6,我正在重构我的代码但是我有这个错误,我的kendo网格的创建和更新功能不再被触发了。我扩展了一堂课。以下是我的代码示例:

getTransport = {
        read: promise => {
          this.getDataForGrid(promise);
        },
        update: function(promise) { // eslint-disable-line
          this.updateForGrid(promise);
        }.bind(this),
        destroy: function(promise) { // eslint-disable-line
          this.destroyForGrid(promise);
        }.bind(this),
        create: function(promise) { // eslint-disable-line
          this.createForGrid(promise).then(data => { // eslint-disable-line
            this.grid.data('kendoGrid').dataSource.read();
          });
        }.bind(this)
      };

getDataForGrid(promise) {
    this.$rootScope.isLoading = true;
    return this.serviceLinked.get()
    .then(response => {
      console.log(response);
      promise.success(
        response
      );
      this.$rootScope.isLoading = false;
    });
  }

  updateForGrid(promise) {
    console.log('update');
    this.$rootScope.isLoading = true;
    return this.serviceLinked.put(promise.data)
    .then(response => {
      promise.success(
        response.data
      );
      this.$rootScope.isLoading = false;
    });
  }

  destroyForGrid(promise) {
    this.$rootScope.isLoading = true;
    return this.serviceLinked.delete(promise.data.id)
    .then(response => {
      promise.success(
        response.data
      );
      this.$rootScope.isLoading = false;
    });
  }

  createForGrid(promise) {
    console.log('create')
    this.$rootScope.isLoading = true;
    return this.serviceLinked.post(promise.data);
  }

任何人都可以帮助我吗?谢谢!

0 个答案:

没有答案