angularjs - Default selected value not working using ng-init -


Just trying to create a default selected value in angular, but thus far I have no luck.

Before compiling, HTML:

  & lt; Choose ng-option = "Choose the value as the name." Ng-model = "rule.MatchLogic" ng-init = "rule.micoglagic = 0" & gt; & Lt; / Select & gt; HTML in browser source:  
  & lt; Select ng-options = "select.value as select.Name Select name to select in rule" ng-model = "Rule.matchLogic" class = "ng-pristine ng-valid" & gt; & Lt; Option value = "?" Selected = "selected" & gt; & Lt; / Options & gt; & Lt; Option value = "0" & ​​gt; All & lt; / Options & gt; & Lt; Option value = "1" & gt; At least & lt; / Options & gt; & Lt; Option value = "2" & gt; Most & lt; / Options & gt; & Lt; / Select & gt;   

How can I assume value = 0 (all) default selected.

You only assign your value to ng-model value rule. Maiticologic must be set to equal the same value in the option. The option you use is select rule .

For example, set the rule. Maiticologic = Choose the rule [some selector]. Value; Inside your controller.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -