2017-02-10 2 views
0

はTypeErrorが

var app = angular.module('app',['ngStorage']); 
 

 
app.controller('myController', ['$scope','$localStorage', function($scope, $localStorage){ 
 
\t var comment = [ 
 
\t \t { \t name : '', 
 
\t \t \t rating : '' 
 
\t \t } 
 
\t ] 
 
\t $scope.saveData = function (review) { 
 
\t \t comment.push(comment); 
 
\t \t localStorage.setItem("review", JSON.stringify(comment)); 
 
\t \t console.log("dkfjhdjhgjh",review); \t 
 
\t }; 
 
\t 
 
}])

JSONに。

+2

入力ボックスはどこにありますか – Sajeetharan

+0

[Chrome sendrequestエラー:TypeError:循環構造をJSONに変換]の重複可能性があります(http://stackoverflow.com/questions/4816099/chrome-sendrequest-error-typeerror-converting-circular-構造 - > json) – Sajeetharan

答えて

1

あなたはコメントを追加しています...コメント!

comment.push(comment); 

これにより、循環参照が作成されます。 多分あなたはやりたいと思っています: comments.push(comment)