我想用angularjs在指令中创建一个上下文菜单,我可以创建一个菜单但不能用子菜单创建.我的意思是,在悬停时打开子菜单.
示例小提琴:示例上下文菜单
我的控制器:
$scope.menuOptions = [
['New User', function () {
console.log("New User");
}],
['Delete', function () {
console.log("Delete");
}]
];
Run Code Online (Sandbox Code Playgroud)
这个小提琴是非常好的,只有我想在这个上下文菜单中添加子菜单.如何根据此示例创建子菜单?
javascript model-view-controller contextmenu dynamically-generated angularjs
我有一个包含子文档数组的文档:
{
"company": "test plc",
"address": [
{
"addr1": "37",
"addr2": "",
"addr3": "test",
"addr4": "",
"addrcity": "",
"addrcounty": "test",
"addrpostcode": "test"
},
{
"addr1": "37",
"addr2": "",
"addr3": "test",
"addr4": "",
"addrcity": "",
"addrcounty": "test",
"addrpostcode": "test"
},
{
"addr1": "37",
"addr2": "",
"addr3": "test",
"addr4": "",
"addrcity": "",
"addrcounty": "test",
"addrpostcode": "test"
}
],
"contacts": [
{
"name": "test",
"surname": "testing",
"title": "master"
},
{
"name": "test",
"surname": "testing",
"title": "master"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我想做的是通过搜索contacts.surname属性返回文档列表。
var …Run Code Online (Sandbox Code Playgroud)