0
をされて使用してngのモデルからデータを取得することはできません。は、ここに私の.htmlをsignalr
<ul class="messages list-unstyled" ng-repeat="newMessage in messages">
<li>
<p>
<span class="username">{{newMessage.username}}</span><br />
</p>
<p>
<span> {{newMessage.message}}</span>
</p>
<p class="no-pad-bottom date-posted">Send {{ newMessage.date }} <span /></p>
<div class="comments">
<ul class="list-unstyled" ng-repeat="newComment in comments">
<li>
<p>
<span class="commentor"> {{newComment.username}}</span>
<span> {{newComment.message}}</span>
</p>
<p class="no-pad-bottom date-posted">Send {{ newComment.date }} <span /></p>
</li>
</ul>
<form class="add-comment">
<div class="row">
<div class="col-md-10">
<input type="text" class="form-control" ng-model="myComment" placeholder="Add a comment" />
</div>
<div class="col-md-2">
<button class="btn btn-default btn-sm" type="submit" ng-click="addComment(newMessage.id)">Comment</button>
</div>
</div>
</form>
</div>
</li>
</ul>
すべてが動作しています。 jsのコントローラのメソッド
$scope.addComment = function (messageId) {
myChatHub.server.addComment(messageId, userName, $scope.myComment);
};
であるあなたは間違っているものを私に教えてくださいすることができ、ここで
私は私のメッセージを送信することができ、そして私も記事を送ることができますが、私はNG-モデル=「myComment」
からnullを取得します?あなたがオブジェクトng-repeat
を使用して..常にng-model
にドットを持つのか、つまり黄金のルールを破っている
はあなたに多くのことを感謝非常に啓発されます! – mrnvdvmv