結果:無限NG-繰り返しと検索フィルタによって発生するループ、次のような検索結果を返す後
[
{
"id": 0,
"name": "UserManagement",
"parent": "modules",
"grandpa": "non",
"viewname": "User Management",
"level": "module",
"template": "UserManagement",
"keywords": "user management users manager managing ",
"description": "module UserManagement My goal is simple. It is a complete understanding of the universe, why it is as it is and why it exists at all . Stephen Hawking",
"partitions": {
}
},
{
"id": 1,
"name": "UsersRoles",
"viewname": "Users Roles",
"level": "partition",
"parent": "UserManagement",
"grandpa": "modules",
"template": "UsersRoles",
"keywords": "users roles accounts ",
"description": "partition UsersRoles The black hole information paradox is a puzzle resulting from the combination of quantum mechanics and general relativity",
"usecases": {
}
},
{
"id": 2,
"name": "Login",
"viewname": "Log in",
"level": "usecase",
"parent": "UsersRoles",
"grandpa": "UserManagement",
"template": "Login",
"keywords": "log in",
"description": " usecase login black hole information paradox"
},
{
"id": 3,
"name": "EditProfile",
"viewname": "Edit Profile",
"level": "usecase",
"parent": "UsersRoles",
"grandpa": "UserManagement",
"template": "EditProfile",
"keywords": "edit profile",
"description": "usecase editprofile black hole information paradox"
},
{
"id": 7,
"name": "Accounting",
"parent": "modules",
"grandpa": "non",
"viewname": "Accounting",
"level": "module",
"template": "Accounting",
"keywords": "accounts",
"description": "module accounting My goal is simple. It is a complete understanding of the universe, why it is as it is and why it exists at all . Stephen Hawking",
"partitions": {
}
},
{
"id": 10,
"name": "NewFiscalRecord",
"viewname": "New Fiscal Record",
"level": "usecase",
"parent": "AccountsAndFiscalRecords",
"grandpa": "Accounting",
"template": "NewFiscalRecord",
"keywords": "NewFiscalRecord",
"description": "usecase new fiscal record"
},
{
"id": 11,
"name": "FiscalReports",
"viewname": "Fiscal Reports",
"level": "partition",
"parent": "Accounting",
"grandpa": "modules",
"template": "FiscalReports",
"keywords": "FiscalReports",
"description": "partition Fiscal Reports",
"usecases": {
}
}
] と「おじいちゃん」と「親」の性質によって結果をグループ化するために、私はlodashを使用しました。次のようにJS:
var nest = function (seq, keys) {
//console.log(keys.length)
if (!keys.length)
return seq;
var first = keys[0];
var rest = keys.slice(1);
return _.mapValues(_.groupBy(seq, first), function (value) {
return nest(value, rest)
});
};
var nested = nest(result, ['grandpa','parent']);
とリターンngのリピート内のビューに「ネストされた」は、 は、「ネストされた」何searchFor「フィルタリターンです:
<div ng-repeat="node in filteredModules = (modules | searchFor:searchString track by $index">
{{node.name}}
</div>
この問題が発生し、理由を特定できません。
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [[{"msg":"fn: regularInterceptedExpression","newVal":119,"oldVal":115}],[{"msg":"fn: regularInterceptedExpression","newVal":123,"oldVal":119}],[{"msg":"fn: regularInterceptedExpression","newVal":127,"oldVal":123}],[{"msg":"fn: regularInterceptedExpression","newVal":131,"oldVal":127}],[{"msg":"fn: regularInterceptedExpression","newVal":135,"oldVal":131}]]
注:私は、データをグループ化することなく、ビューに結果を返すとき、それは問題ありません。ビューで表示せずにコンソールに「入れ子になった」と印刷すると、うまく動作し、エラーが発生しません。 ここで詳細を説明しようとしています:https://jsfiddle.net/qw332bkc/
編集:「おじいちゃん」と「親」プロパティで結果をグループ化する別の方法はありますか?
さて、あなたはエラーが発生し、原因何のための任意の説明がありますか? @JRoller –
@HalaElBarchahこのエラーの理由を説明する私の編集をご覧ください – Shizzle
は、複雑な角度表現をデバッグしようとするとうまくいっていませんが、javascriptでロジックを実行し、できるだけ単純なng-repeat – Aprillion