directive is undefined ,是我的angularJs下错了?
下面是main.js
angular.module("myApp",[])
.controller('SignUpController',function($scope){
$scope.userdata = {};
$scope.submitForm = function(){
console.log($scope.userdata);
if ($scope.signUpForm.$invalid)
alert('请检查您的信息');
else
alert('success');
};
})
.directive('compare',function(){
var o ={};
o.strict = 'AE';
o.scope = {
orgText :'=compare'
};
o.require = 'ngModel';
o.link = function(sco,ele,att,con){
con.$validator.compare = function(v){
return v == scope.orgText;
};
sco.$watch('orgText',function(){
con.$validate();
})
};
})