How to get textbox value from json in Angularjs -


i'm new angularjs, have 2 text boxes , button. first textbox fill age(15 66 - numbers only). second textbox fill term in "nine" / "twelve" / "fifteen" in string only. (else radio buttons ok in place of second textbox have no idea how implement problem.). after entering 2 fields click on button have get:

term data entered age , "nine" / "twelve" / "fifteen" json data only.

"age: 44 , term: 785.5"

ex: in first textbox have entered "44" age, , in second textbox have entered "twelve" (or else have selected "12" in radio button), , click on button have value "age: 44 , term: 785.5"

working fiddle

i have no idea how dynamically change "ng-bind='pa.term.twelve'" value(twelve value):

<ul>    <li ng-repeat="pa in t816 | filter:getage">       <p>          term 12 data: <b data-ng-bind="pa.term.twelve"></b>       </p>    </li> </ul> 

any appreciated.

not best way it, can try kind of expressions:

<p ng-if="getterm === 'nine'">term 9 data: <b data-ng-bind="pa.term.nine" ></b></p> <p ng-if="getterm === 'twelve'">term 12 data: <b data-ng-bind="pa.term.twelve"></b></p> <p ng-if="getterm === 'fifteen'">term 15 data: <b data-ng-bind="pa.term.fifteen"></b></p> 

using ng-if render p getterm selected.

i updated fiddle reflecting given solution.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -