以下是我的代码:
$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中工作.
我可以看到非静态类的静态对象不能在方法内创建?
码:
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) 我正在玩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)
我做了明显错误的事吗?