angular指令与指令交互

app.directive('mansory',function(){
    return {
        controller:function($scope){
            this.changed = function(){
                $scope.changed();
            }
        },
        link: function(scope,element,attr){
            scope.changed = function(){
                console.log('我已改变');
            };   
        }
    };
}]);

app.directive('mansoryRepeatFinish',function(){
    return {
        require:'^mansory',
        link: function(scope,element,attr,mansoryCtrl){
            if(scope.$last == true){
                mansoryCtrl.changed();
            }
        }
    };
});
原文地址:https://www.cnblogs.com/gongshunkai/p/8092778.html