我需要實現點擊外到內隱藏下拉指令,所以我有這樣的代碼:如何角元素比較jQuery的元素
$(document).click(function(e) {
var selector = $(e.target).closest('.time-selector');
if (!selector.length) { // || !selector.is(element)) {
if ($scope.$$phase) {
$scope.show = false;
} else {
$scope.$apply(function() {
$scope.show = false;
});
}
}
});
,但它不工作(不隱藏),當我點擊不同的.timer-selector
元素,我試着測試!selector.is(element)
但這不起作用。
那麼如何測試我的jQuery選定元素是否與角度指令元素相同的DOM節點?
不知道這是相關的,但我的指令沒有replace
。
元是我的'',可能是我有問題的代碼將工作時,有是'替換:真'。 –
jcubic