问题标签 [angular-chosen]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
174 浏览

angularjs - ng-repeat 不更新数组更新 - Angular Chosen

我有一个选择框,我对其应用了角度选择。以下是完整的 HTML

选择框正在从控制器范围内的数组中填充$scope.reportValuesOptions = [];

有一个init函数在加载时调用以在框中div设置默认值select

HTML中有一个在单击以在数组中添加值时button调用该函数addReport$scope.reportValuesOptions

但是单击此button按钮时,添加到数组的值不会反映在select框中。这些值也应该可以select作为它的 boxoption

完整示例

0 投票
3 回答
1319 浏览

angularjs - AngularJS - 选择的本地化 ng-change 不起作用

我试图检测何时从 AngularJS 选择的 localytics 下拉列表中选择一个选项。

这是下拉菜单的代码:

在我的控制器中,我具有以下功能:

它第一次工作正常,但如果我想在控制台中选择另一个选项,我会收到以下错误,并且下拉菜单不会选择我想选择的另一个选项:

未捕获的类型错误:无法设置未定义的属性“已选择”

我该如何解决这个问题?

非常感谢。

0 投票
1 回答
1206 浏览

css - 角度选择的多选下拉

我在表单底部有一个角度选择的多选元素,并希望将其设为下拉框,而不是下拉框。Angular-chosen似乎没有下拉选项。select元素生成的html如下:

这是我想要向上移动的 .chosen-drop div。

如果我设置 .chosen-drop 元素的 css 顶部值以将元素移动到正确的位置,它的定位是完美的,但是在过滤列表时,发现很少或没有项目,下拉列表相对于顶部缩小下拉元素,在下拉列表(父 div 上方)和父 div 顶部之间留有空隙。

如果我将 .chosen-drop 元素的 css 底部值设置为将其移动到父元素上方,过滤项目使其向下缩小,消除下拉列表和父 div 之间的差距,但是一旦选择了更多项目,父div 高度增长,改变了下拉(dropup)框所需的位置。这是因为 css 底部值保持 .chosen-drop div 的底部相对于其父 div 的底部。

有没有办法设置 .chosen-drop div 的底部值相对于其父 div 的顶部?

0 投票
1 回答
811 浏览

angularjs - ng-disabled 在 Angular Chosen 中不起作用

我的项目中有两个select盒子。第一个显示格式,第二个有两个options,即“是”和“否”。我在这两个盒子上都使用了角度选择。

最初,第二个选择框中的“是”选项被禁用。option当用户从第一个select框中选择“PDF”作为格式时,我想启用它。

这些是我的选择框

我正在调用ng-change第一个select框,它将“是” option( $scope.disableoption) 设置为truefalse基于其选择

功能如下

问题是当我从第一个select框中选择“PDF”作为选项时,“是”option不会更新。

如果我chosenselect盒子中取出它可以正常工作,但不能使用chosen

选择的示例

未选择的示例

0 投票
0 回答
122 浏览

angular-ui-bootstrap - 选择选项后选择的角度不关闭

我正在使用选择的角度来增加我的选择选项,一切都很好。
但是,当我尝试将其放入模式中时,选择其中一个选项会关闭模式,但chosen仍保持打开状态。

尝试使用:backdrop: 'static',在我的模态中。一样。

选择的选择:

莫代尔工厂。

有什么我想念的吗?

PS没有错误,只是看起来很难看.. 在此处输入图像描述

0 投票
3 回答
322 浏览

javascript - 想要在选择多个中添加无作为值

我将 selected.jquery.js 用于选择字段

但在模型中没有数据的情况下,它只显示数据占位符值。我想在列表中显示“选择身体部位”作为选项。用户不得选择此项。原因是,我想在 Body_Parts 列表中添加动态“未知”值。但它没有反映在列表中。

选择具有单一选择的相同工作。

0 投票
2 回答
367 浏览

javascript - 如何将 ng-options 用于嵌套数组?

我正在使用选择的角度来列出选项。但是如何将 ng-options 用于嵌套数组?

这是我的阵列。

我想按类别名称列出选项组位于这个
cat1
action1
action2
cat2
action3
action4
cat3
action5
action6

0 投票
1 回答
76 浏览

javascript - angularjs多选:单击时将表单输入保存到变量

我一直按照这个视频中的说明制作我自己的带有角度和选择的多选搜索下拉菜单。

我想知道是否有人可以帮助我弄清楚如何将选择保存到变量中,以便我可以将其从客户端发送到服务器端并将其用作 python 脚本的输入。最好,我想在点击时做到这一点。我添加了一个虚拟按钮...

我可以从 html 中访问 ng-model 值,但不能在应用程序/控制器中访问。

索引.html

the_app.js

0 投票
3 回答
150 浏览

angularjs - Angular JS ng-options 从 JSON 中选择列表

我正在尝试使用selectwithng-options来填充我的下拉列表。这是我的 JSON

{ "Food": [ { "Name": Apple, "HealthCondition": [ { "Name": "High Blood Pressure", "Eat": null }, { "Name": "High Cholesterol", "Eat": null }, { "Name": "Heart Disease", "Eat": null }, { "Name": "Osteoporosis", "Eat": null }, { "Name": "Digestive Disorder", "Eat": null } ] }

这是我的选择<select class="chosen-select" ng-model="selectedValue" ng-options="x.HealthCondition for x in myResults.Food" multiple chosen></select>,我得到的结果是[object Object],[object Object],[object Object],[object Object],[object Object]

我正在尝试获取健康状况名称的列表!任何帮助将不胜感激。难倒了几个小时。我正在使用Angular Chosen指令。如果我只使用 Name 字段,这可以正常工作,x.Name但我想获取 HealthCondition Name。

任何帮助将不胜感激!

0 投票
1 回答
116 浏览

javascript - Dynamically generating Ids for option elements with Angulars' Chosen

We are currently using chosen (https://harvesthq.github.io/chosen/) to generate a multi-select drop down. Our template looks something like this:

The above code shows us getting the list from our controller, filtering the information from the list which is then displayed as the options of the select.

This generates html like this:

For the purposes of selenium testing I need to add id attributes to the list items. Is there a way to do this with angular or chosen?

What I'd like is something like this:

I currently have a solution which works by getting the elements in the DOM and generating the ids after the page has loaded but this seems overly complicated.

Thanks

UPDATE

lin, after some prodding, provided a link to a SO question about why you shouldn't mix AngularJS and JQuery: "Thinking in AngularJS" if I have a jQuery background? The exchange between the top answer writer and the top commenter to that answer contains the following exchange:

"I'm not rewriting FancyBox in jQuery to keep a pure Angular app." - top commenter

"Most jQuery plugins can be rewritten in AngularJS cheaply...if you can't think of a solution, ask the community; if after all of that there is no easy solution, then feel free to reach for the jQuery" - top answerer

So to clarify my question, is there a solution to my problem that would not require me to rewrite this jQuery plugin?

For clarity, and to hopefully avoid another exchange like the one I had with lin - I am working as part of a team. I do not have the remit to rebuild the application. I was asked to perform a single specific task. I am working within the constraints of the management of my team. I am not going to quit my job over design decisions on a front end application or over a management decision that I, as a back end developer, was asked to look at the front end.