javascript - How can I tell an angularjs dropdown to refresh? -


I have a button that shows a dropdown on click, a UI dialogue is generated when clicking on each element of the dropdown . When the UI is opened, the related items are checked in the dropdown. Clicking the element in the dropdown will stop the dialog again, and uncheck it in the list.

The dialog can also be closed with the dialog 'X' on the dialog. I need this closing action to uncheck the related element in the dropdown. It is inside my controller:

   Data grid & lt; Span class = "caret" & gt; & Lt; / Span & gt; & Lt; / Button & gt; & Lt; Ul class = "dropdown-menu" role = "menu" & gt; & Lt; Li & gt; & Lt; A href = "#" ng-click = "shorefitter =! Show rotation; openclosgreat ('pathfinder', showiteficht);" & Gt; & Lt; Span ng-class = "{glyphicon glyphicon-ok icon-OK check-mark": showRouteFeature, 'glyphicon no-icon':! ShowRouteFeature} "& gt; & Lt; / Span & gt; & Lt; Span class = "text" & gt; Root feature & lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;  

And I have a close event in my .js file:

  $ (document) .on ('click', '.ui-dialog -Chitalebar-off ', function () {$ scope.showRouteFeature = false; $ scope.apply ();});  

The formatting is a bit short but I did what I could. When I click on an option in the drop down, the toggle is set (ng clicking "on showRouteFeature true to false and vice versa. When I click on the 'x' on the dialog It sets $ scope.showRouteFeature to false, which can uncheck the element in the dropdown. I can see in the console that when I click, $ scope.showRouteFeature lies set to 'X'.

I asked this question, and this post, this issue It is because of the reason that I have the variable for variables after setting the $ scope.apply () . However, it does not just refresh my dropdown. Appreciate any insights

This may not be your problem, but I suspect it may be: < / P>

A word of warning, when using direct priorities on the scope as your example, you know better Normally should be avoided it. The reason is that if a child scope does, so th e prototype inheritance will not reflect on the scope of the parents to make property within the child. Many underlying thorny instructions produce children (ng-repeat, ng-if, ng-switch comes in mind) you do not show ng-repeat in your code, but if you think that this is in your actual code, then I anticipate working. So keep the property in something.

It's a good way to find out that this is your problem, keep {{showRouteFeature}} at the highest level of HTML, then keep it in depth at its many levels. If they start to vary in value, then you have a heritage inherited problem.

For more information see the first point here:


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -