 
                        weChatDirective.directive('tab1', function() {
    return {
        restrict: 'E',
        replace : true,
        templateUrl: '..',
        controller : function($scope){
            $scope.viewdata = {    
                   "type":"view",
                   "name":"外部连接",
                   "url":"http://www.soso.com/"
            };
            this.viewdata = $scope.viewdata;
            
        },
        link: ...
    };
});
weChatDirective.directive('tabReply', function() {
    return {
        restrict: 'E',
        require : '^tab1', 
        controller : ["$scope",function($scope){
            $scope.hasChanged = function(){};
        }],
        replace: true,
        templateUrl: './dist/weChat/templates/weChatMenuReply.html',
        link: function(scope, element, attr,reController) { 
            console.log(reController);
        }
    }
})
tab1指令中的viewdata变化的时候 想要执行tabReply指令里的hasChanged函数 如何实现??大神赐教。还是我陷入思维误区了。。。。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
在tabReply指令的controller中加上一行
没这样尝试过,如果2个指令需要通信时,可以使用事件$emit,$on来进行。