Saturday, 15 February 2014

javascript - AngularJS - Hide a form when a select option value equals specific value -


Please help implement this functionality. If the option value == 1, hide the form below.

  & lt; Ng-model = "selection" & gt; & Lt; Option value = "1" & gt; 1 & lt; / Options & gt; & Lt; Option value = "2" & gt; 2 & lt; / Options & gt; & Lt; Option value = "3" & gt; 3 & lt; / Options & gt; & Lt; Option value = "4" & gt; 4 & lt; / Options & gt; & Lt; Option value = "5" & gt; 5 & ​​lt; / Options & gt; & Lt; Gt selection and; & Lt; Form ng-hide = "isHidden" & gt; & Lt ;! - Option value to hide when hidden == 1 - & gt; & Lt ;! - Here are some HTML code ... - & gt; & Lt; / Form & gt;   

Here is a part of the controller.

  $ scope.isHidden = true; If ($ scope.selection == '1') {$ scope.isHidden = false; }   

The current code is not working. Please help me implement it Thank you.

You just see selection in Ng-hide Instructions:

  & lt; Form ng-hide = "selection == '1'" & gt; & Lt ;! - Here are some HTML code ... - & gt; & Lt; / Form & gt;   

This is one.

No comments:

Post a Comment