angular - Angular Elements 8 在使用 @Input() 时不适用于 EDGE/IE11
问题描述
我正在尝试使用 Angular Elements 8 创建一些自定义元素,并且在我的@Input() 上使用简单对象作为字符串/数字时效果很好。但是当我想开始使用对象数组时,IE EDGE/11 会抛出异常。
程序
克隆 repo(代码github repo)或执行以下操作:
ng新的“一些名字”
更新浏览器列表以包含 IE11
ng 生成组件简单列表
为带有输入的组件编写代码
提供解决方案(没有我知道的角度元素),一切正常。
添加角度元素(ng add @angular/elements)
将模块修改为引导组件作为自定义元素
使用 EDGE 服务和加载,查看控制台错误
TypeError: Unable to get property 'setInputValue' of undefined or null reference at listItems.set (http://localhost:4300/vendor.js:77430:35) at DefaultDomRenderer2.prototype.setProperty (http://localhost:4300/vendor.js:80310:9) at DebugRenderer2.prototype.setProperty (http://localhost:4300/vendor.js:76553:9) at setElementProperty (http://localhost:4300/vendor.js:73738:5) at checkAndUpdateElementValue (http://localhost:4300/vendor.js:73648:13) at checkAndUpdateElementInline (http://localhost:4300/vendor.js:73576:5) at checkAndUpdateNodeInline (http://localhost:4300/vendor.js:74992:13) at checkAndUpdateNode (http://localhost:4300/vendor.js:74935:9) at debugCheckAndUpdateNode (http://localhost:4300/vendor.js:75957:5) at debugCheckRenderNodeFn (http://localhost:4300/vendor.js:75935:13)"
这是一个已知的缺陷还是我错过了一些重要的东西?
解决方案
这是 Angular/Elements 中的一个缺陷。使用 document-register-elements 时,polyfill 不能可靠地调用构造函数。
要解决此问题,请为@webcomponents/custom-elements等自定义元素切换到另一个 polyfill
我为您的项目创建了一个分支并解决了这个问题。
推荐阅读
- asp.net-mvc - ASP.NET MVC 应用程序中的 SessionState
- bash - Writing a script to copy two files from each directory to each of their corresponding directories
- clojurescript - Can i use (if) as a form-2 reagent render-function
- apache - How to replace a standard httpd package with httpd24-httpd from Software Collections?
- php - 如何将关联的php数组json_encode为[{x:key1,y:value1},{x:key2,y:value2},...]?
- kotlin - 如何使用带有命名参数和默认值的自定义设置器
- asp.net-core-mvc - 列名无效 Departments.DepartmentID
- python - Is there a way to export a series of scenes rendered in Panda3D as individual image files?
- asp.net-mvc - Adding Viewbag in Current view
- apache-poi - Apache POI Date Parsing One Second Off