更新范围变量时,Angular Json Tree Directive不会重新加载

时间:2016-01-30 11:17:23

标签: angularjs angularjs-directive angularjs-ng-repeat

刚开始使用AngularJS进行编码。目前我正试图在github.com/awendland/angular-json-tree上使用以下插件显示JSON树

现状: 如果数据是静态范围变量,则树显示完全正常。 ScreenShot of the working scenario

问题 当我尝试在获取AJAX数据后显示JSON树时出现问题。使用新数据更新指令变量,但树结构似乎不会重新编译并返回结构。ScreenShot of the Problem

我怀疑它的角度树指令不是"刷新"。 那里的任何大师都可以帮助解决这个问题吗?提前谢谢。

1 个答案:

答案 0 :(得分:0)

您是否尝试使用$ scope包装AJAX回调。$ watch函数:

$myemail = 'example@gmail.com';//myemail
$name =filter_input(INPUT_POST, 'name');
$email_address = filter_input(INPUT_POST, 'email');
$message = filter_input(INPUT_POST, 'message');



$to = $myemail;

$email_subject = "Contact form submission: $name";

$email_body = "You have received a new message. ".

" Here are the details:\n Name: $name \n ".

"Email: $email_address\n Message: \n $message";

$headers = "From: $myemail\n";

$headers .= "Reply-To: $email_address";

mail($to,$email_subject,$email_body,$headers);