gpt4 book ai didi

angularjs - 如何在 angucomplete-alt selected-object 属性上使用回调函数?

转载 作者:行者123 更新时间:2023-12-04 10:36:54 33 4
gpt4 key购买 nike

我目前正在处理以下代码:

<angucomplete-alt id="skill1"
selected-object="addSkill1()"
remote-url="@Url.Action("GetSkills", "ManageMission")/?query="
title-field="Name"
minlength="1"
match-class="angucomplete-match"
input-class="form-control"
template-url="@Url.Content("~/Templates/angucomplete-alt.html")"></angucomplete-alt>

$scope.addSkill1 = function () {
console.log(arguments);
};

通过使用回调函数,我试图获取选定的对象值 ( as explained in angucomplete-alt documentation ),但我收到以下错误:

Error: [$compile:nonassign] Expression 'addSkill1()' used with directive 'angucompleteAlt' is non-assignable!

最佳答案

我从以下位置挖掘示例:Angucomplete Alt我发现你必须提供 selected-object像这样,即使它是 回调功能:

<angucomplete-alt id="skill1"
selected-object="addSkill"
remote-url="@Url.Action("GetSkills", "ManageMission")/?query="
title-field="Name"
minlength="1"
match-class="angucomplete-match"
input-class="form-control"
template-url="@Url.Content("~/Templates/angucomplete-alt.html")"></angucomplete-alt>

回调方法应该收到 selected项目作为参数:
$scope.addSkill = function (selected) {
console.log(selected);
};

关于angularjs - 如何在 angucomplete-alt selected-object 属性上使用回调函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29655138/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com