Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript KnockoutJS可观察值为';t通过选择设置_Javascript_Jquery_Knockout.js_Durandal - Fatal编程技术网

Javascript KnockoutJS可观察值为';t通过选择设置

Javascript KnockoutJS可观察值为';t通过选择设置,javascript,jquery,knockout.js,durandal,Javascript,Jquery,Knockout.js,Durandal,我目前正在使用knockoutJS+Durandal开发一个带有JEE后端的Web应用程序,但我的问题是,当我更改我的选择时,我感觉我的可观察对象没有设置 因此,我选择了index.html <label for="language" class="col-xs-12 col-sm-3 control-label no-padding-left no-padding-right"></span> Language selection:</la

我目前正在使用knockoutJS+Durandal开发一个带有JEE后端的Web应用程序,但我的问题是,当我更改我的选择时,我感觉我的可观察对象没有设置

因此,我选择了index.html

    <label for="language" class="col-xs-12 col-sm-3 control-label no-padding-left no-padding-right"></span>
        Language selection:</label>
    <div class="col-sm-9">
        <select id="language"
                data-bind="options: possibleLanguage, optionsText: 'text', optionsValue: 'key', value: selectedLanguage"
                class="col-xs-12 col-sm-5"/>
        <span class="text-muted hidden-xs col-sm-12 no-padding-left">Select the language used to display the interaction.</span>
    </div>
作为记录,正如您所见,我有一个订阅我的tokenValue observable,这个可以工作,在html中设置如下

 <label for="token" class="col-xs-12 col-sm-3 control-label no-padding-left no-padding-right"></span>
                Token:</label>
            <div class="col-sm-9">
                <input id="token" type="text" data-bind="value: tokenValue, valueUpdate: 'keyup'"
                       class="col-xs-12 col-sm-5 margin-top-5"/>
                <span class="text-muted hidden-xs col-sm-12 no-padding-left">Insert the token used for authentication.</span>
            </div>

代币:
插入用于身份验证的令牌。
我确信在99%的情况下,当我选择其他内容时,
selectedLanguage
的值没有设置,因为我在html数据绑定和toaster中添加了
event:{change:languageHasChanged}
,该绑定和toaster应该附加可观察对象的值,但显示为空

我可以使用一些很好的老jQuery找到一个解决方法,但如果您能帮助我订阅这些工作,我将不胜感激

提前谢谢

你的车通过了

optionsValue: 'key',
在数据绑定中,在数组上传递“值”

possibleLanguage.push({value: "F", text: "French"});
你的车正在通过

optionsValue: 'key',
在数据绑定中,在数组上传递“值”

possibleLanguage.push({value: "F", text: "French"});

的确我太专注于可观测到的物体可能是有车的这一事实而看不到这一点。。。谢谢:-)的确。。。我太专注于可观测到的物体可能是有车的这一事实而看不到这一点。。。谢谢:-)