指令未使用嵌套DOM编译

时间:2016-03-31 00:51:27

标签: angularjs

我有以下指令

angular.module('frame',[])

.directive('frame',function(){
  return{
    restrict:'E',
    link: function(scope,element){
      console.log(element);
    }
  };
})

;

其单元测试的摘录

it('frame images, centralizing it',function(){

    var elm = $compile("<frame><div>Hi</div></frame>")(scope);
    scope.$digest();

  });
}

指令中的console.log不会输出任何内容。

当我$compile("<frame></frame>")(scope)时,它才有用。换句话说,当<frame></frame>没有嵌套时。

我感谢任何帮助。

0 个答案:

没有答案
相关问题