2016-05-16 137 views
4
使用$ event.srcElement問題

我有我的代碼這是使用@ event.srcElement,例如許多地方......在Chrome角2 - 火狐

<label><input (change)="setCompare($event.srcElement.checked,item.id, item.name, item.capacity, item.photoId,item.occupiers[0])" type="checkbox">Compare availability</label> 

工作正常,但用FF是拋出:

錯誤:

EXCEPTION: Error in app/templates/results.html:35:22 ORIGINAL EXCEPTION: TypeError: event.srcElement is undefined ORIGINAL STACKTRACE: [email protected]http://localhost:3002/app/components/results/results.component.js:124:9 anonymous/[email protected]ponent.template.js:268:15 DebugAppView.prototype.eventHandler/<@http://localhost:3002/node_modules/@angular/core/src/linker/view.js:316:24 decoratePreventDefault/<@http://localhost:3002/node_modules/@angular/platform-browser/src/dom/dom_renderer.js:278:36 DomEventsPlugin.prototype.addEventListener/outsideHandler/<@http://localhost:3002/node_modules/@angular/platform-browser/src/dom/events/dom_events.js:20:93 Zonehttp://localhost:3002/node_modules/zone.js/dist/zone.js:323:20 NgZoneImpl/this.inner<[email protected]http://localhost:3002/node_modules/@angular/core/src/zone/ng_zone_impl.js:45:32 Zonehttp://localhost:3002/node_modules/zone.js/dist/zone.js:322:20 Zonehttp://localhost:3002/node_modules/zone.js/dist/zone.js:230:29 [email protected]http://localhost:3002/node_modules/@angular/core/src/zone/ng_zone_impl.js:78:67 [email protected]http://localhost:3002/node_modules/@angular/core/src/zone/ng_zone.js:228:58 DomEventsPlugin.prototype.addEventListener/[email protected]http://localhost:3002/node_modules/@angular/platform-browser/src/dom/events/dom_events.js:20:56 Zonehttp://localhost:3002/node_modules/zone.js/dist/zone.js:356:24 Zonehttp://localhost:3002/node_modules/zone.js/dist/zone.js:256:29 ZoneTask/[email protected]http://localhost:3002/node_modules/zone.js/dist/zone.js:423:29

有關如何解決它的任何建議 - 或:更多的東西瀏覽器無關替換$ event.srcElemento?

回答