<ul class="msg-common" ng-show="showAnswer">
<li ng-repeat="mn in m.fastReply" ng-click="sh = mn.content "> {{mn.content}}</li>
</ul>
<p class="answer" ng-show="showAnswer">
<textarea >{{sh}}</textarea>
</p>
As shown above, implement sh to access mn.content to implement changes in textarea!
漂亮男人2017-05-15 16:52:04
The least modified solution is to use $parent.sh = mn.content
http://jsfiddle.net/Gerhut/umuakzr3/
Because $parent is not recommended to be used, the recommended solution is to add a function similar to setSh in the parent scope and call it directly in the child scopesetSh(mn.content)
.
http://jsfiddle.net/Gerhut/umuakzr3/1/
If you use Angular version 1.2 or above, you can also use the Controller as method to directly obtain the reference of the parent Controller.