javascript - Md-select populated with both static & dynamic options will not work right -
we have slight issue project handed over, little knowledge of limitations of angular-material , angular1.
the code in question this:
<md-select ng-model="test" md-on-close="selectvalue(test)"> <md-option ng-value="'default'" ng-selected="true"> default </md-option> <md-option ng-value="'numbered'"> numbered </md-option> <md-option ng-value="'elections'"> elections </md-option> <md-option ng-repeat="attr in data.legend" ng-value="'{{attr.style}}'"> {{attr.title.text}} </md-option> </md-select> $scope.selectvalue = function(val){ console.log ( val ) }
the problem function taking test value console.log fine when selected item 1 of hardcoded ones, log nothing or undefined if click on 1 of dynamic items generated in part of application (which works fine), not sure right way deal this. changing md-select select , md-options options works, no idea problem is. tried assigning data model directly desired value did not work either used function instead debug , see going on.
i suspect md-select 'initialising' somewhere , @ stage keeps hardcoded one/already present ones, work, moment data.legend object changed , dropdown changes, not take them account. our knowledge on angular slim not sure look/what do?
Comments
Post a Comment