0
私は一日中このことに固執しています。私は"メッセージを送信"を押すとanglejsでスコープ変数が変更されましたが、ビューは変更されません
<table>
<tr ng-repeat="x in usernames">
<td>{{x.username}}</td>
<td>
<button type='button' ng-click='sendMessage()'>Send Message</button>
</td>
<td>
<button type="button" ng-click="deleteUser()">Delete User</button>
</td>
</tr>
</table>
、コントローラが正常に点火されます。
$scope.sendMessage = function() {
$scope.content_in = '<form novalidate>'
+'<label>Message:  </label> <input type="text" ng-model="message"/><br><br>'
+'<button id="mybutton" style="width:75px" ng-click="send()">Send</button>'
+'<input id="mycancel" style="width:75px" type="reset" value="Cancel"/>'
+'</form>';
}
私は単純にcontent_in
変数に格納されますメッセージフォームでの私のページを更新しようとしています。しかし、変更はビューに反映されません。
私も含ま:コントローラで
$scope.$watch('content_in', function() {
alert('hey, content_in has changed!');
});
を、と私は変更がコントローラで行われていることを確信しています。 ビューに変更を反映させるにはどうすればよいですか?
をDIV追加するには、デザインのページで、次のアプローチ
を試してみてください。関連するマークアップを提供するか、jsFiddleまたはplunkerが最適です。どうも! –
$ scopeを使用してみてください$ apply –
代わりに 'ngShow'' ngIf'または' ngBindHtml'を使用できませんでしたか? –