如何让ng-click表现得像ng-changed?因为每次单击按钮,它都会通过AJAX发送数据。所以x.status值会改变。
这是我的HTML
<button ng-click="status(x);" ng-switch="x.status">
<span ng-switch-when="orderer">SHOW</span>
<span ng-switch-when="orderer_hidden">HIDE</span>
<span ng-switch-when="creator">SHOW</span>
<span ng-switch-when="creator_hidden">HIDE</span>
</button>
仅当我刷新页面时,ng-switch才会触发。
已更新
这是脚本
$scope.status = function(data){
$http({
method: "GET",
url: Ajax_call.ajaxurl,
params: {
id: data.id,
status: data.status,
action: "status_changed"
}
});
}