어떤 이유인지 comment.content 부분은 저장하려고 할 때마다 null로 판명되었지만 comment.pid는 잘 작동합니다. 그 이유는 무엇입니까? 그것은 나에게 의미가 없다.하나의 값은 AngularJS에 저장되지 않습니다
컨트롤러 :
var CreateCommentController = function ($scope, $location, $routeParams, Comment) {
$scope.action = "Create";
var id = $routeParams.postId;
var content = $scope.content;
var comment = new Comment();
comment.pid = id;
comment.content = content;
$scope.save = function() {
Comment.save(comment, function() {
$location = '/';
});
}
};
html로 :
<div class="control-group" ng-class="{error: form.content.$invalid}">
<label class="control-label lbl" for="content">Content:</label>
<div class="controls">
<textarea ng-model="content" id="content" class="textareaContent">content</textarea>
</div>
NG 모델을 .content " –