在$ scope。$ emit和$ scope。$ on上发出问题

时间:2017-03-24 07:49:31

标签: javascript angularjs angular-material

当我在选择列表中添加新内容时,它的工作时间没有刷新页面但是当删除选项需要刷新页面以获取相关数据列表时,不会发生这种情况。

//This event call when add and remove 

     $scope.$emit("UserSetting_Update",true);


// add a module to the library

     $scope.$on('UserSetting_Update', function (event, data) {
            console.log('UserSetting recived:', data);
            $scope.getControlData();
        });







   // save CategoryItem

    console.log("save obj"+obj);
    client.onComplete(function (data) {

        $rootScope.Usertoolbox = obj;
        $scope.$emit("UserSetting_Update",true);
        $scope.showMessage('Saved your changes');
    });
    client.onError(function (data) { 
    $scope.showMessage('There was an error storing your changes');
});
    client.insert([obj], {
        KeyProperty: "UserID"
    });

0 个答案:

没有答案