search

Home  >  Q&A  >  body text

angular.js - How does ng-model bind a variable-named property of an object?

<input ng-model="node.varname">
node is an object on the scope, var is a varname on the scope, I want to bind the input box to the name on the
node On the attribute that is the value of varname: for example, if varname="car"; it is bound to node.car and solved

PHP中文网PHP中文网2791 days ago583

reply all(1)I'll reply

  • 某草草

    某草草2017-05-15 17:09:41

    ng-model="node[varname]"

    reply
    0
  • Cancelreply