question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

material_select does not update display value after selected option has been changed by program

See original GitHub issue

I have create an angular directive to initialize select control:

  SelectDirective = function($timeout) {
    return {
      restrict: 'A',
      link: function($scope, element, attrs) {
        return $timeout(function() {
          return $(element).material_select();
        }, 50);
      }
    };
  };

to create select control in jade:

   .col.s6.input-field
      select#priority(md-select, ng-model='vm.priority')
         option(value='0') 0
         option(value='1') 1
         option(value='2') 2
         option(value='3') 3
      label(for='priority') Priority

The issue is that the select control doesn’t update the display value when the priority value has been changed in controller. However, the priority value is changed according to the selected option value by mouse or key operation.

Is it possible to have a public method to select value in material_select? So that it’s feasible to $watch ng-model value in directive to update the display value by the method.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
yangpucommented, May 9, 2015

It looks nothing changed to re-initialize the select control after select options or value is changed.

1reaction
b1rdexcommented, May 7, 2015

http://materializecss.com/forms.html

Updating/Destroying Select

If you want to update the items inside the select, just rerun the initialization code from above after editing the original select.

$(document).ready(function() {
    $('select').material_select();
  });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 6 Material mat-select change method removed
I have this issue today with mat-option-group. The thing which solved me the problem is using in other provided event of mat-select : ......
Read more >
Select | Angular Material
<mat-select> is a form control for selecting a value from a set of options, similar to the native <select> element. You can read...
Read more >
Double material select element (second one fetching content
Hey guys, I've encountered problems with the new Material select. If I select a country in select1 the material select freezes and so...
Read more >
angular select does not load my selected option | Nerd For Tech
The importance of the compare function compareWith() , a property used with the form control for comparing option values with selected values.
Read more >
Angular Material Select Change Event - ConcretePage.com
Angular Material Select provides selectionChange event that emits when the selected value has been changed by the user.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found