如何使用指令方法启用/禁用锚标记?
例:
JAVASCRIPT:
angular.module('ngApp', []).controller('ngCtrl',['$scope', function($scope){
$scope.create = function(){
console.log("inside create");
};
$scope.edit = function(){
console.log("inside edit");
};
$scope.delete = function(){
console.log("inside delete");
};
}]).directive('a', function() {
return {
restrict: 'E',
link: function(scope, elem, attrs) {
if(attrs.ngClick || attrs.href === '' || attrs.href === '#'){
elem.on('click', function(e){
e.preventDefault();
if(attrs.ngClick){
scope.$eval(attrs.ngClick);
}
});
}
}
};
});
Run Code Online (Sandbox Code Playgroud)
由于我已声明成功和错误ajax选项,其中响应为204,ajax方法转到选项成功,这会导致错误.
根据我们可以使用的文档,StatusCode或Complete方法,但这里的缺点是必须声明所有状态代码如2 ?? 系列,3 ?? 系列,4 ?? 系列!由于这些响应是动态的,我不确定http状态代码.
那么,这是在jquery ajax中处理http状态代码的更好方法吗?
click: function() {
if (!hasPlotLine) {
chart.xAxis[0].addPlotLine({
value: 5.5,
color: '#FF0000',
width: 2,
id: 'plot-line-1'
});
} else {
chart.xAxis[0].removePlotLine('plot-line-1');
}
hasPlotLine = !hasPlotLine;
}
Run Code Online (Sandbox Code Playgroud)
我试图添加和删除点击事件的情节线,我最终得到这个皇帝"无法读取属性xAxis of undefined"
是否可以在图表的点击事件上绘制一条线?
chart: {
events: {
click: function(event) {
alert ('x: '+ event.xAxis[0].value +', y: '+
event.chartY );
var chart = event.xAxis[0];
chart.removePlotLine('plot-line-1');
chart.addPlotLine({
value: event.chartX,
color: '#FF0000',
width: 2,
id: 'plot-line-1'
});
}
}
},
Run Code Online (Sandbox Code Playgroud)
我最初在highcharts的plotoptions click事件上做了同样的事情.现在,使用图表点击事件做同样的事情?但无法获得系列xaxis对象.