Javascript My angular 7 web组件@Input<;布尔值>;不';当我绑定一个假值时,它不起作用

Javascript My angular 7 web组件@Input<;布尔值>;不';当我绑定一个假值时,它不起作用,javascript,angular,angular-elements,Javascript,Angular,Angular Elements,我已经安装了一个应用程序,它使用angular自定义元素包从angular 7导出web组件。 一切正常。我能够使用元素实例绑定javascript中的任何内容、数组、对象和字符串: const table = document.createElement('my-table-element'); table.someInputProp = 'Works Great'; table.otherInput = ['my', 'working', 'array']; 当我尝试绑定到一个文本假值时,

我已经安装了一个应用程序,它使用angular自定义元素包从angular 7导出web组件。 一切正常。我能够使用元素实例绑定javascript中的任何内容、数组、对象和字符串:

const table = document.createElement('my-table-element');
table.someInputProp = 'Works Great';
table.otherInput = ['my', 'working', 'array'];
当我尝试绑定到一个文本假值时,问题出现了:

table.myBooleanInput = false
这不会改变组件@Input myBooleanInput=true上的任何内容 这个值永远都是正确的。无论它更改多少次为false

/** Set any stored initial inputs on the component's properties. */
    ComponentNgElementStrategy.prototype.initializeInputs = function () {
        var _this = this;
        this.componentFactory.inputs.forEach(function (_a) {
            var propName = _a.propName;
            var initialValue = _this.initialInputValues.get(propName);
            if (initialValue) {
                _this.setInputValue(propName, initialValue);
            }
            else {
                // Keep track of inputs that were not initialized in case we need to know this for
                // calling ngOnChanges with SimpleChanges
                _this.uninitializedInputs.add(propName);
            }
        });
        this.initialInputValues.clear();
    };
我可以把它作为一个真实的价值观来加以约束,使它呈现得恰到好处。问题只在使用文本false时出现

这是本期的工作副本:

提前谢谢


PS:如果我在另一个angular应用程序中使用web组件,绑定工作正常。

我实际上也遇到了同样的问题。在调试它时,@angular/elements(我使用的是7.2.15版)包中似乎有一些代码,当属性的计算结果为false时,它跳过了初始化属性的设置

/** Set any stored initial inputs on the component's properties. */
    ComponentNgElementStrategy.prototype.initializeInputs = function () {
        var _this = this;
        this.componentFactory.inputs.forEach(function (_a) {
            var propName = _a.propName;
            var initialValue = _this.initialInputValues.get(propName);
            if (initialValue) {
                _this.setInputValue(propName, initialValue);
            }
            else {
                // Keep track of inputs that were not initialized in case we need to know this for
                // calling ngOnChanges with SimpleChanges
                _this.uninitializedInputs.add(propName);
            }
        });
        this.initialInputValues.clear();
    };

作为一种解决方法,您可以将标志转换为字符串,将其包装在对象中,或者从组件中查看元素属性。

是否确定其他输入可以工作?(名称)因为在stackblitz上它不工作。抱歉,我将它更新为一个新的堆栈项目@Dino,现在它工作了(false除外)。如果使用getter和setter,它可能有助于调试。另外,为自定义元素定义赋予组件本身不同的元素名称也很有用