这是我的代码我收到错误"无法读取属性$ emit of undefined"哪里出错了?
.directive('managesubcategorybusinesses',function()
{
return function(scope,element,attrs,$rootScope)
{
element.bind("click",function()
{
scope.getBusinesses(attrs.subcategoryid,function(data)
{
$rootScope.$emit("CallSubcategoryBusinesses",{data : data});
console.log("tadaa");
})
});
};
})
答案 0 :(得分:0)
你必须使用范围代替$ rootscope
scope.$emit