我在AngularJS和Firebase中进行了半聊天。用于显示我使用的消息<li ng-repeat="message in messages">
。我注意到新消息输入中的任何更改(不在li
范围内)都会触发创建聊天的刷新(?)。
<ul>
<li ng-repeat="message in messages">
{{message.auther}}: <span ng-bind-html="deliberatelyTrustDangerousSnippet(urlify(message.text))"></span>
<!-- diss/like a message -->
<button ng-click="message.like = !message.like; invertLike($index)">
<span ng-show="!message.like">Like Button</span>
<span ng-show="message.like">Dislike Button</span>
</button>
</li>
</ul>
<!-- push a new message onto the array -->
<form ng-submit="addMessage()">
name: <input ng-model="auther" /> <br />
message: <input ng-model="newMessageText" />
<button type="submit">Add Message</button>
</form>
(在这里可以找到tesratelyTrustDangerousSnippet和urlify的代码:http://pastebin.com/wLRLHfHy)
有没有办法停止刷新?感谢