為什么會(huì)出現(xiàn)Cannot set property 'compare' of undefined
app.directive('compare',function(){
?? ??? ??? ?var o={};
?? ??? ??? ?o.strict='AE';
?? ??? ??? ?o.scope={
?? ??? ??? ??? ?orgText:'=compare'
?? ??? ??? ?}
?? ??? ??? ?o.require='ngModel';
?? ??? ??? ?o.link=function(sco,ele,att,con){
?? ??? ??? ??? ?con.$validators.compare=function(y){
?????????????????? return y==sco.orgText; ?
?? ??? ??? ??? ?}
?? ??? ??? ??? ?sco.$watch('orgText',function(){
?? ??? ??? ??? ??? ?con.$validate();
?? ??? ??? ??? ?})
?? ??? ??? ?}
?? ??? ??? ?return o;
?? ??? ?})