形式仅与自身注册
$scope在控制器的 后
控制器已经最初运行。因此,
console.log($scope.theForm)即使一切都正确设置,也会返回undefined。
在示例中,对的存在做出反应
theForm,您可以设置观察器
theForm以根据其存在来设置调试文本:
$scope.$watch('theForm', function(theForm) { if(theForm) { $scope.formDebugText = 'Form in Scope'; } else { $scope.formDebugText = 'Form is Undefined'; } });可以在http://jsfiddle.net/9k2Jk/1/上看到



