自定义指令restrict

angular.module('myApp',[],['$compileProvider',function ($compileProvider) {
    $compileProvider.directive('customTags',function () {
        return{
            restrict:'ECAM',//默认M不显示在浏览器,但会编译执行
            template:'<div>custom-tags-html</div>',//默认替换节点内容
            replace:true,//为true时替换所在元素,为false则追加到元素内部,并且让 restrict注释M方式显示在浏览器显示
            compile:function () {
                console.log(1);
            }
        }
    })
}]);

  

posted @ 2017-10-18 11:14  zhujhhxx  阅读(184)  评论(0编辑  收藏  举报