angularjs - show/hide content based on select value -


I want to show / hide content based on a sepipiginal value selected in the dropdown, but it is not working. $ scope.list = {'val1': 'abc', 'val2': 'xyz'}; $ Scope.Solidated Val = 'well 1' $ scope.isEnabled = $ scope.selectedVal == 'val1'? right wrong;

html code

  & lt; Select ng-model = "selectedVal" ng-option = "for v as (k, v) in the list" & gt; & Lt; / Select & gt; & Lt; Div ng-if = "enabled" & gt; & Lt; Span & gt; Show me & lt; / Span & gt; & Lt; / Div & gt;   

I have not shown / hidden on the change of selectbox, what is wrong?

var app = angular Module ('app', []); App.controller ('fCtrl', function ($ scope) {$ scope.list = {'val1': 'abc', 'val2': 'xyz'}; $ scope.selected val = 'well 1' $ radius. $ Watch ('SelectedVal', function () ($ scope.isEnabled = $ scope.selectedVal == 'val1' true: false;});});
  & lt; script src =" https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js "& gt; & Lt; / script & gt; div ng-app = "app" & gt; div ng-controller = "fCtrl" & gt; & lt; select ng-model = "selectedVal" ng-option = "As for V (" K, V ") in the list">  
Show & lt; / span & gt; & lt; / div & gt;

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -