我试图弄清楚如何获得有效成分|处理obj1.getMappingResult().putAll(obj2.getMappingResult());
String jsonString = objMapper.writeValueAsString(obj1);
事件时将焦点对准元素。我尝试过ng-blur
,但它始终是“ body”。
window.document.activeElement
<body>
<div name="element1" ng-blur="$ctrl.onBlur($event)">element1</div>
<div name="element2" ng-blur="$ctrl.onBlur($event)">element2</div>
</body>
使用public onBlur($event: any): void {
var value = $event.target.attributes["name"].value;
// value is the name of the element where the event is triggered
// but how to get the element to where the focus has gone to?
}
服务将其修复。
$timeout
答案 0 :(得分:0)
使用$ timeout服务修复了该问题。
public onBlur($event: any): void {
this.$timeout(() => {
if (this.$window.document.activeElement) {
// do things
}
}, 1);
}