小编Man*_*kla的帖子

Angular JS中使用Patch方法的HTTP请求问题

以下是我的代码:

  $http({
      url: 'https://apistage.dealsignal.com/api/v0/company_watchlists/' + wishlist_id,
      method: 'PATCH',
      params: {
          list: {
              add_company_ids: ['61737'],
              name: 'My Wishlist'
          },
          api_key: 'CtxY3Kpc7ZDL8VDfLmPt9wss'
      }
  })
      .success(function(response) {
          console.log(response);
      }).
  error(function(response) {
      console.log(response);
      return false;
  });
Run Code Online (Sandbox Code Playgroud)

我收到错误的请求错误,但补丁方法的相同请求正在Chrome上的REST CLIENT中工作.

javascript patch angularjs

8
推荐指数
2
解决办法
2062
查看次数

为什么不能在方法内创建非静态类的静态对象?

我可以看到非静态类的静态对象不能在方法内创建?

码:

  public class Rent {

      public void abc() {
          System.out.println("Non static method");
      }
      public static void def() {
          System.out.println("this is static method");
      }
  }

  public class SampleJava {

      public static void main(String[] args) {
          Rent r1 = new Rent();
          public static Rent r2; //not allowed in static method
      }

      public static Rent r3; //allowed outside method

      public void def() {
          Rent r4 = new Rent();
          public static Rent r5; //not allowed in non-static method either
      }
  }
Run Code Online (Sandbox Code Playgroud)

java static

1
推荐指数
1
解决办法
1246
查看次数

Javascript事件监听器在页面加载时触发,而不是单击事件

我正在玩Javascript并创建了一个类.在初始化类时,我向某个div添加一个按钮,然后在单击该按钮时向该按钮添加一个事件监听器.但是,当页面加载时,函数会被触发,而不是在单击按钮时触发.这是我的代码:

    function Photobank(){
        this.photos;
        this.addPhotoButton;
    }

    Photobank.prototype.init = function(){
        var btn = document.createElement('button');
        btn.id = "photoupload";
        var t=document.createTextNode("ADD PHOTOS");
        btn.appendChild(t);
        this.addPhotoButton = btn;
        var pb = document.getElementById('photobank');
        pb.appendChild(this.addPhotoButton);
        this.addPhotoButton.addEventListener("click", this.launchMediaManager(), false);
    }

    Photobank.prototype.launchMediaManager = function(){
        alert("Launching Media Manager");
    }
Run Code Online (Sandbox Code Playgroud)

我做了明显错误的事吗?

javascript

0
推荐指数
1
解决办法
5319
查看次数

标签 统计

javascript ×2

angularjs ×1

java ×1

patch ×1

static ×1